Note that there are some explanatory texts on larger screens.

plurals
  1. POcore data iCloud merge protocol
    text
    copied!<p>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:</p> <ul> <li><p>to add an entitlements file (in recent Xcode, this can be done using by selecting the target, select "Summary pane", scroll down, check enable entitlements"</p></li> <li><p>to add the correct options while adding the persisten store, in my case</p> <pre><code>NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys: // other options @"&lt;arbitrary name&gt;", NSPersistentStoreUbiquitousContentNameKey, iCloudURL, NSPersistentStoreUbiquitousContentURLKey, nil] </code></pre> <p>where</p> <pre><code>NSURL * iCloudURL = [[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:nil]; </code></pre></li> </ul> <p>The `nil' here indicating that information from the Entitlements.plist file is used. </p> <ul> <li>enabling iCloud support for the app through the developer portal. This might involve generating a unique app-ID, something I hadn't done before. </li> </ul> <p>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. </p> <p>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. </p> <p>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. </p> <p>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?</p> <p>Thanks </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload