CloudKit: Delete local objects based on CKQueryNotification

Viewed 712

I'm building an app that heavily relies on CloudKit for data synchronization. Each time the app launches, it catches up with all changes that have been made on the server using a CKFetchNotificationChangesOperation. This successfully returns all objects that have been created and/or modified, but I am now at the stage that I also want my app to delete records based on these messages.

In my app, each object that I have stored in CoreData also carries the recordID of the online representation of that object. This way I can easily pick up objects I need to modify.

This seems hard when deleting objects, as CloudKit only returns recordID's for these objects, and does not provide a recordType that I can use to know what object I am looking for in my CoreData Database.

Question

How does one correctly handle CloudKit 'deleted' notifications in a case with multiple record types?

2 Answers
Related