I'm currently struggling with Core Data iCloud migration.
I want to move a store from an iCloud ubiquity container (.nosync
) to a local URL. The problem is that whenever I call something like this:
[self.persistentStoreCoordinator migratePersistentStore: currentiCloudStore
toURL: localURL
options: nil
withType: NSSQLiteStoreType
error: &error];
I get this error:
-[NSPersistentStoreCoordinator addPersistentStoreWithType:configuration:URL:options:error:](1055): CoreData: Ubiquity: Error: A persistent store which has been previously added to a coordinator using the iCloud integration options must always be added to the coordinator with the options present in the options dictionary. If you wish to use the store without iCloud, migrate the data from the iCloud store file to a new store file in local storage. file://localhost/Users/sch/Library/Containers/bla/Data/Documents/tmp.sqlite. This will be a fatal error in a future release
Anyone ever seen this? Maybe I'm just missing the right migration options?
Use Core Data with CloudKit to give users seamless access to the data in your app across all their devices. Core Data with CloudKit combines the benefits of local persistence with cloud backup and distribution. Core Data provides powerful object graph management features for developing an app with structured data.
You use CloudKit to store your app's existing data in the cloud so that the user can access it on multiple devices. You can also store data in a public area where all users can access it.
Cost. Although the running cost of servers is a big deal for developers. But in case of CloudKit you don't have to be worried about paying large expenses at all. As it offers a reasonable storage amount completely free.
My guess is that, based on the error message, by setting your options to nil, the PSC is unable to move the store. You probably need to get the dictionary of options for the original store and pass those along instead of setting them to nil.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With