davidav
davidav

Reputation: 900

core data iCloud merge protocol

I've managed to get my existing core data app to work with iCloud. After days of study, it was actually surprisingly simple. It seems that 3 things are essential:

The `nil' here indicating that information from the Entitlements.plist file is used.

Actually, at the moment I am not sure this last step is crucial for development---i've enabled another app without this last step and it seems to work.

Anyhow, I've noticed that two existing core data bases of the same app on different iDevices will synchronise new entries to the core data stack, but will not automatically sync the existing records.

One way of syncing data from device A to B is to delete the existing core data database on B, and then restart the app on B. However, this is not a proper merge.

Does anybody know a way to merge two existing core data databases on different apps at the moment the apps are upgraded to use iCloud support, i.e., use the options above and all that?

Thanks

Upvotes: 20

Views: 1877

Answers (1)

LavaSlider
LavaSlider

Reputation: 2504

I have not done it, but when saving to the iCloud there is high risk for conflicting information if the data has also been updated or exists on another device. If the conflicts are not properly resolved then the flow between the two devices will not occur properly. Resolving the conflicts can be complicated but the simplest would be to just let the most recent win. Apple has conflict handling procedures that get triggered when saving to overwrite to the ubiquitous store identifies a conflict.

Upvotes: 1

Related Questions