I want to sync my Core Data boot app with iCloud. Apple's sample project shows how to configure NSPsistentStoreCoordinator to enable iCloud. The code roughly looks like this:
persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel: [self managedObjectModel]]; NSDictionary* options = [NSDictionary dictionaryWithObjectsAndKeys:@"com.company.app", NSPersistentStoreUbiquitousContentNameKey, cloudURL, NSPersistentStoreUbiquitousContentURLKey,nil]; [psc addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeUrl options:options error:&error]);
The problem is that if the data is already saved in iCloud, this method will permanently return persistentStoreCoordinator. If I do it synchronously, I look at a blank screen for several minutes, if I do it asynchronously, my application is completely unusable because I cannot interact with Core Data.
Of course, I could add a permanent store, as I would without iCloud, and then let iCloud work asynchronously?
Basically, my question is what does iCloud do for the time it takes for the initial synchronization, and can I use persistentStoreCoordinator first and let the data sync in the background?
source share