UbiquityStoreManager icon indicating copy to clipboard operation
UbiquityStoreManager copied to clipboard

Push, pull and merge?

Open NorbNorb opened this issue 10 years ago • 0 comments

If I have three devices A, B and C, all working on their own local stores first (iCloud disabled). How can I

  • Push: Device A enables cloud and uses its local store to overwrite any data in iCloud and other devices can pull from there.
  • Pull: Device B enables cloud and deletes its local cloud store for rebuilding it from iCloud.
  • Merge: Device C enables cloud and keeps its local data, but merges incoming transaction logs.

My implementations so far are:

  • Push:
[[[AppDelegate sharedAppDelegate] ubiquityStoreManager] deleteCloudContainerLocalOnly:NO];
[[[AppDelegate sharedAppDelegate] ubiquityStoreManager] setCloudEnabled:YES];
  • Pull:
[[[AppDelegate sharedAppDelegate] ubiquityStoreManager] deleteCloudContainerLocalOnly:YES];
[[[AppDelegate sharedAppDelegate] ubiquityStoreManager] deleteLocalStore];
[[[AppDelegate sharedAppDelegate] ubiquityStoreManager] setCloudEnabled:YES];
  • Merge:
[[[AppDelegate sharedAppDelegate] ubiquityStoreManager] deleteCloudContainerLocalOnly:YES];
[[[AppDelegate sharedAppDelegate] ubiquityStoreManager] setCloudEnabled:YES];

Our observations are that a push of device A followed by a pull of device B work if iCloud wasn't populated before. Devices will be in sync then. But if the devices disable iCloud again and make another push & pull procedure, all pulling devices don't show any data.

We can get the devices back in sync if we do a objective-c[[[AppDelegate sharedAppDelegate] ubiquityStoreManager] deleteCloudContainerLocalOnly:NO]; wait for a short time and then hit the the push and pull buttons on the devices again.

NorbNorb avatar Jul 16 '14 20:07 NorbNorb