バックグラウンド:
現在、iCloud を使用してコア データ データストアを使用するアプリがアプリストアにあります。
エンティティと新しいエンティティにフィールドを追加しました。
自動移行をセットアップしましたが、すべて機能すると思います。(何もクラッシュしません)
100% 動作することを確認する方法はありますか? これがそのようなマイナーな変更への最良のアプローチだと思いますか? 一部のユーザーがクラッシュする可能性があるリリースはしたくありません。
自動移行を実装するコードは次のとおりです。
NSURL *storeUrl = [NSURL fileURLWithPath:storePath];
// this needs to match the entitlements and provisioning profile
NSURL *cloudURL = [fileManager URLForUbiquityContainerIdentifier:nil];
NSString* coreDataCloudContent = [[cloudURL path] stringByAppendingPathComponent:@"iLearn_LessonPlans"];
cloudURL = [NSURL fileURLWithPath:coreDataCloudContent];
// The API to turn on Core Data iCloud support here.
NSDictionary* options = [NSDictionary dictionaryWithObjectsAndKeys:@"com.danielanderton.iLearn_LessonPlans.1", NSPersistentStoreUbiquitousContentNameKey, cloudURL, NSPersistentStoreUbiquitousContentURLKey, [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption, [NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption,nil];
NSError *error = nil;
[psc lock];
if (![psc addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeUrl options:options error:&error]) {
NSLog(@"error");
}
[psc unlock];