Search code examples
ioscore-dataicloud

How do I enable iCloud and migrate Core Data on a release update?


I have a released V1.0 of an iPhone App which uses Core Data but no iCloud. Now I will like to release V2.0 with iCloud support.

I am using https://github.com/mluisbrown/iCloudCoreDataStack/blob/master/iCloudCoreDataStack/PersistentStack.m as a template, and everything seems to work.

Because the previous release did not have iCloud, and the new one will, I will like to migrate the local copy to the iCloud one on the first time the user opens the new version.

How do I do that? Can I simply somehow copy the whole sqlite file from local to iCloud? The schema is the same between 1.0 and 2.0.

I plan to ask the user if they want to use local Vs. iCloud (as per guidelines), but if they say Yes, I want to just do a bulk copy somehow.

Thanks


Solution

  • I have just posted a sample iOS library style Core Data app which includes iCloud integration. The app includes a Settings Bundle for the user to toggle "Use iCloud" preference settings and will migrate the store to and from iCloud depending on the users settings.

    Download from the link below - sorry about the documentation - will get around to that at some point but it works much the same way as the UIManagedDocument example.

    http://ossh.com.au/design-and-technology/software-development/