core data - addPersistentStoreWithType Returns Error 'attempt to insert nil key' for iCloud Storage -
i'm trying create core data storage in icloud, when try , add persistent store first time (expecting creation), error...
'-[__nscfdictionary setobject:forkey:]: attempt insert nil key'
i've seen couple of other similar posts, recommendations in code. here code snippet.
// set options nsurl *ubiquitouscontenturl = [ubiq urlbyappendingpathcomponent:@"transactionlogs"]; nsstring *storeubiquitouscontentname = @"progressdata"; nsdictionary *options = [nsdictionary dictionarywithobjectsandkeys: ubiquitouscontenturl, nspersistentstoreubiquitouscontenturlkey, storeubiquitouscontentname, nspersistentstoreubiquitouscontentnamekey, nil]; // url 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]; thanks ray
found issue. seems have create 'localdata.nosync' directory manually. doesn't created if doesn't exist.
Comments
Post a Comment