Bartłomiej Semańczyk
Bartłomiej Semańczyk

Reputation: 61784

How to subscribe for changes made on CKShare?

I need to know about:

Is it possible at all?

Upvotes: 2

Views: 497

Answers (1)

Bartłomiej Semańczyk
Bartłomiej Semańczyk

Reputation: 61784

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

Upvotes: 5

Related Questions