Core data addPersistentStoreWithType返回错误';尝试插入nil键';用于iCloud存储

Core data addPersistentStoreWithType返回错误';尝试插入nil键';用于iCloud存储,core-data,icloud,nspersistentstore,Core Data,Icloud,Nspersistentstore,我试图在iCloud中创建一个核心数据存储,但是当我第一次尝试添加持久存储时(期望创建),我得到了错误 “-[\uu NSCFDictionary setObject:forKey:]:尝试插入nil键” 我已经看到了一些其他类似的帖子,但是这些建议已经在我的代码中了。这是我的代码片段 // set options NSURL *ubiquitousContentURL = [ubiq URLByAppendingPathComponent:@"Transacti

我试图在iCloud中创建一个核心数据存储,但是当我第一次尝试添加持久存储时(期望创建),我得到了错误

“-[\uu NSCFDictionary setObject:forKey:]:尝试插入nil键”

我已经看到了一些其他类似的帖子,但是这些建议已经在我的代码中了。这是我的代码片段

        // 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];
谢谢
Ray发现了问题。似乎我必须手动创建“LocalData.nosync”目录。如果它不存在,则不会创建它