我正在尝试在 iCloud 中创建核心数据存储,但是当我第一次尝试添加持久性存储(期望创建)时,我收到错误...
'-[__NSCFDictionary setObject:forKey:]: 尝试插入零键'
我看过其他一些类似的帖子,但这些建议已经在我的代码中。这是我的代码片段。
// set options
NSURL *ubiquitousContentURL = [ubiq URLByAppendingPathComponent:@"TransactionLogs"];
NSString *storeUbiquitousContentName = @"ProgressData";
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
ubiquitousContentURL, NSPersistentStoreUbiquitousContentURLKey,
storeUbiquitousContentName, NSPersistentStoreUbiquitousContentNameKey, nil];
// get url for progress db
NSURL *progressUrl = [ubiq URLByAppendingPathComponent:@"Documents/LocalData.nosync/ProgressData.sqlite"];
// create or open core data sql progress database
NSError *error = nil;
progressModel = [[NSManagedObjectModel mergedModelFromBundles:nil] retain];
progressContext = [[NSManagedObjectContext alloc] init];
progressPsc = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:progressModel];
[progressContext setPersistentStoreCoordinator:progressPsc];
[progressPsc lock];
[progressPsc addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:progressUrl options:options error:&error];
[progressPsc unlock];
谢谢雷