1

It seems CKQuerySubscription cannot be used for subscribing to shared DB changes in cloud kit. CKDatabaseSubscription neither works nor does CKSubscription

How can I achieve subscribing to Shared DB changes?

Simply. How can i achive a notification about change made on record that is shared with me. I AM NOT THE OWNER OF THE RECORD.

Related question is here:

How to receive cloudkit notifications about changes made on record shared with me?

Bartłomiej Semańczyk
  • 59,234
  • 49
  • 233
  • 358
Dunes Buggy
  • 1,779
  • 1
  • 21
  • 41

2 Answers2

2

I struggled for some time to successfully subscribe using CKDatabaseSubscription when the database had been shared with me. It worked fine when I was the one sharing. The mistake I was making was that I was using the same subscriptionID in both cases. You need a unique subscriptionID if you want subscription to the shared database.

0

Turns out, its not possible to subscribe on a zone level or a record level for Shared DB in CloudKit. Ref: https://developer.apple.com/library/content/qa/qa1917/_index.html

Be aware that CKQuerySubscription is not supported in the shared database, and 
CKDatabaseSubscription currently only tracks the changes from custom zones in the private and shared database.
Bartłomiej Semańczyk
  • 59,234
  • 49
  • 233
  • 358
Dunes Buggy
  • 1,779
  • 1
  • 21
  • 41
  • If this answer is accepted, why has it been down voted? – Reinhard Männer Nov 02 '17 at 16:39
  • Well, I can't downvote on my own answer. Maybe the person was pissed at Apple/CloudKit Developer for not supporting it. – Dunes Buggy Nov 02 '17 at 18:28
  • This answer is incorrect. It IS possible to subscribe on a zone level to a shared DB so the device with the shared DB will receive record change notifications. It is just not possible to query if the subscription has been set-up. – TheBasicMind Oct 18 '18 at 11:25
  • Umm, maybe it changed recently? Not saying that I'm correct, but I remember I couldn't get it to work. Anyway, will have to try Phil's recommendation yet. – Dunes Buggy Oct 18 '18 at 14:36
  • @TheBasicMind, I would love to see code on how to subscribe if you can share. – Dunes Buggy Oct 18 '18 at 14:37