Re: iCloud sync per app activation
Re: iCloud sync per app activation
- Subject: Re: iCloud sync per app activation
- From: Martin Hewitson <email@hidden>
- Date: Sun, 05 Feb 2012 09:43:08 +0100
>>
>
> I'm finishing up a shoebox app now and I do have the option to store things in iCloud or not. My eventual solution to this was to have a preference screen in the app with a single "enable iCloud' switch. If you flip it from off to on, or on to off, you get a section of buttons to hit asking how you want to perform the transition (eg when transitioning to the cloud you can merge local to cloud, use cloud or use local), it then gives you a confirmation box before you do it. I failed to find a really good way to do this in preferences, so I put it in the app itself, there are just too many questions about how you want to perform the migration which I think need to be asked then.
>
Hi Roland,
I'm starting to think about how to implement this in my OS X app. Would you be willing to share any clues as the correct strategies? How to merge the managed object contexts? How to make sure that changes accumulated locally while not syncing with iCloud are then transferred to the cloud? If I want to replace the 'truth' in the cloud with the local store, how do I make sure that all the necessary transactions exist so that other clients update themselves?
The reason I'm worried about the correct way to do this is due to the following scenarios:
1) Starting from a completely new app
Here I've been able to configure and sync a persistent store as long as I have the ubiquity keys in the store options the very first time the app runs. If I want to change the 'truth' in the cloud, or start from a fresh persistent store, I haven't found a reliable way to do that. Deleting the local store doesn't work for me. Essentially the only thing that works is the solution in point 2) below.
2) Starting from an existing app with an existing persistent store.
One thing I've noticed (at least on OS X) is that if I have an existing core data store which was previously being used without iCloud, and then I add the iCloud ubiquity keys to the store options, the contents of the store (the full sql data store) are not pushed to the cloud container when the app starts. In order to get this to work I've need to use -migratePersistentStore:toURL:options:withType:error: to move the existing store to a new URL. Then the full store is uploaded and everything works from there.
So, switching between these two states (with a user option) seems tricky to me. At least I can't see a good way to handle.
Any clues, help, or insights gratefully received!
Martin
>
>
>>
>>
>>
>>
>> _______________________________________________
>>
>> Cocoa-dev mailing list (email@hidden)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Martin Hewitson
Albert-Einstein-Institut
Max-Planck-Institut fuer
Gravitationsphysik und Universitaet Hannover
Callinstr. 38, 30167 Hannover, Germany
Tel: +49-511-762-17121, Fax: +49-511-762-5861
E-Mail: email@hidden
WWW: http://www.aei.mpg.de/~hewitson
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden