forked from alekseyn/iCloudStoreManager
-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Description
I'd like to check if an app update brought a new Core Data model version. If so, I'd like to migrate the cloud data, disable iCloud and work offline then. In particular:
- manually migrate the cloud store in
ubiquityStoreManager:willLoadStoreIsCloud:to the new model version migrateCloudToLocalsetCloudEnabled = NO(step 2 does this already automatically)
or in code:
- (void)ubiquityStoreManager:(UbiquityStoreManager *)manager willLoadStoreIsCloud:(BOOL)isCloudStore
{
if (isCloudStore)
{
NSURL *cloudStoreURL = manager.URLForCloudStore; // WRONG: gives ubiquity directory, not an sql file
if ([self isMigrationNeededForSourceStoreURL:cloudStoreURL])
{
[self migrateStoreToCurrentModel:cloudStoreURL];
[manager migrateCloudToLocal]; // This will also set iCloud disabled
}
}
}My problem is that I cannot do the manual migration without knowing the URL to the persistent store file (sqlite). When ubiquityStoreManager:willLoadStoreIsCloud: is called there's no store coordinator which can tell me where the file is or which cloud store file to use.
Also, can I call migrateCloudToLocal within ubiquityStoreManager:willLoadStoreIsCloud:?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels