Reputation: 3930
In my app, I'd like to sync data between my devices. I can get changes by asking for entities with an modificationDate
greater than something... That way I get all new and modifier entities since a given date.
So far so good.
Now users will be able to delete entities as well. What is the best way using CloudKit
to get those recordIDs? Is there any way? Is there a way to ask for record ID's that got deleted since a given date?
Or will I only be able to archive that using a soft delete?!?
Upvotes: 1
Views: 393
Reputation: 2855
If you are storing a local cache of all of the items, use CKFetchRecordChangesOperation.
This functionality is literally built for "when you maintain a local cache of your record data and need to synchronize that cache periodically with the server", and provides changed records and deleted record IDs.
Note, however, that it only works in non-default zones, which means it won't work:
You'll need to create a custom zone in the private database using CKModifyRecordZonesOperation.
If you're storing the user's private data, this is the way to go.
Upvotes: 2
Reputation: 1319
You can get information about data changes with CloudKit subscriptions API
Upvotes: 0