CloudKit - what to do when a user adds, modifies or deletes an object while offline?

I ran into the problem of what to do when the user does a deletion, for example, offline? I considered using addQueue, modifiedQueue and deletedQueue and saved them with NSCodingand NSKeyedArchiver. Perhaps I would use a kit or a dictionary. Then I will iterate over them in the background or after each application launch and delete them with success. Does that sound reasonable? Does anyone have experience in this issue that they can share? I searched a lot for answers, including looking at all the discussions at CloudKit WWDC.

I save all my data locally using Core Data, so I thought about adding a property to add or change, but it wonโ€™t work so well for deletion.

+2
source share
1 answer

What about a separate database table (i.e. the main data object) for changes to the queue?

You can have separate actions for each (as you described), or you have one property (for example, โ€œactionโ€) in the object of the object with variables in the queue. Then you can either try it regularly, you can check the connection before trying to synchronize the changes, and, as you said, swipe through them and clear them of success.

0
source

Source: https://habr.com/ru/post/1657706/


All Articles