configurePersistentStoreCoordinatorForURL:ofType: modelConfiguration: storeOptions:error
configurePersistentStoreCoordinatorForURL:ofType: modelConfiguration: storeOptions:error
- Subject: configurePersistentStoreCoordinatorForURL:ofType: modelConfiguration: storeOptions:error
- From: Chris Idou <email@hidden>
- Date: Wed, 30 Jun 2010 16:42:39 -0700 (PDT)
According to the doco, the above method is used to "customise creation of the persistent store" especially with regards to the store type. So I've been using the below code, which works perfectly fine for NSBinaryStoreType and NSXMLStoreType, but with NSSQLiteStoreType I get lots of merge errors when saving documents that I don't get if I completely remove the below code and let the framework handle it. Apparently I'm doing something subtlety wrong. Does anyone know what? At times like this I wish Apple would make their source code visible to developers.
- (BOOL)configurePersistentStoreCoordinatorForURL:(NSURL *)url ofType:(NSString *)fileType modelConfiguration:(NSString *)configuration storeOptions:(NSDictionary *)storeOptions error:(NSError **)error; {
if(![[[selfmanagedObjectContext] persistentStoreCoordinator] addPersistentStoreWithType:NSSQLiteStoreTypeconfiguration:nilURL:url options:[NSDictionarydictionaryWithObjectsAndKeys:[NSNumbernumberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption, [NSNumbernumberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil] error:error]){
[[NSApplicationsharedApplication] presentError:*error];
returnNO;
} else {
returnYES;
}
}
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden