2

I need to know about:

  • when the record IS NOT shared with me anymore
  • when permissions was changed from readwrite to only read

Is it possible at all?

Bartłomiej Semańczyk
  • 59,234
  • 49
  • 233
  • 358

1 Answers1

5

Oh, answer is simple:

let shareSubscription = CKQuerySubscription(recordType: "cloudkit.share", predicate: NSPredicate(value: true), options: options)

Works only for private database, in other words for the OWNER of shared records, for users who created CKShare.

If you need to subscribe for changes from the other side. For users participating in this share (invited to that share) you need to simply create CKDatabaseSubscription.

let subscription = CKDatabaseSubscription(subscriptionID: "pl.blue-world.fieldservice.sharedDatabase")
subscription.database = sharedDatabase
Bartłomiej Semańczyk
  • 59,234
  • 49
  • 233
  • 358
  • Do you have any idea how a user participating in the share can be notified if they are **removed** from the share? It seems they get a notification if they are subscribed to the shared database, but the notification doesn’t contain any records or any other indication that they no longer have access. – Clifton Labrum Oct 13 '18 at 02:06
  • I posted my question here in case you happen to know the answer: https://stackoverflow.com/questions/52788219/how-to-be-notified-if-the-owner-removes-me-from-a-ckshare-on-cloudkit – Clifton Labrum Oct 13 '18 at 02:07