私が正しく使用しているCoreDataのUIManagedDocumentがあります。 。 。addPersistentStoreWithTypeがnullを返します(iOS、CoreData、iCloud)
NSURL *localUrl = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
localUrl = [localUrl URLByAppendingPathComponent:@"Default Notes Database"];
//self.noteDatabase = [[UIManagedDocument alloc] initWithFileURL:localUrl]
ここで、iCloudでコアデータを保存しようとする過程でNSPersistentStoreインスタンスを作成しようとしています。しかし、私のデータモデルとURLを使ってNSPersistentStoreを作成しようとすると、NSPersistentStoreは常にnilになります。
NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"Notes" withExtension:@"momd"];
NSPersistentStoreCoordinator *migrationPSC = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL]];
// Open the store
id sourceStore = [migrationPSC addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:iCloudUrl options:@{ NSPersistentStoreUbiquitousContentNameKey: @"InhoNotesiCloudStore",NSSQLitePragmasOption: @{@"journal_mode":@"DELETE"},NSMigratePersistentStoresAutomaticallyOption:@YES,NSInferMappingModelAutomaticallyOption:@YES } error:nil];
ソースストアはありません。なぜこれは無償ですか?私は答えを探したが、オンラインで何も見つけられなかった。