CloudKit subscription only works when operation is performed in CloudKit Dashboard and not when done programmatically

I have set up a CKQuerySubscription in the default zone that sends a Push notification every time a record meeting the given criteria is deleted in a public CloudKit database. However, the notification is only sent when I delete the record via the CloudKit Dashboard and not when I delete a record programmatically.

I have tried creating a record with User A on a device and then having that record deleted by User B on a different device but it doesn't result in User A getting notified.

Additionally, the only case where the notification gets sent is on a device that is signed in with the iCloud account that I use for CloudKit Console. In other words, when I delete a record that was created by a user with a different iCloud account than the one I use for the CloudKit Console the notification does not get sent to that device - it's only successful on the device with the CloudKit Console iCloud account.

What I expect to happen is the subscription to fire when the record in question is deleted regardless of how and by whom it is deleted. Is this possible?

Any help would be appreciated.

Post not yet marked as solved Up vote post of swiftic Down vote post of swiftic
407 views

Replies

It seems that any operation that I perform programmatically on the public CloudKit database (creating a record, deleting a record) is not triggering the subscription I set up to fire, even when the subscription's predicate is set to NSPredicate(value: true). The subscription only fires when I perform these operations manually on the CloudKit Dashboard. It seems that I need to find a way to replicate the actions that take place when I perform operations on the Dashboard in my code...