- (BOOL)configurePersistentStoreCoordinatorForURL:(NSURL *)url ofType:(NSString *)fileType modelConfiguration:(NSString *)configuration storeOptions:(NSDictionary *)storeOptions error:(NSError **)error
{
NSMutableDictionary *options = nil;
if (storeOptions != nil) {
options = [storeOptions mutableCopy];
} else {
options = [[NSMutableDictionary alloc] init];
}
[options setObject:[NSNumber numberWithBool:YES]
forKey:NSMigratePersistentStoresAutomaticallyOption];
[options setObject:[NSNumber numberWithBool:YES]
forKey:NSInferMappingModelAutomaticallyOption];
BOOL result = [super configurePersistentStoreCoordinatorForURL:url
ofType:fileType
modelConfiguration:configuration
storeOptions:options
error:error];
[options release], options = nil;
return result;
}
The resulting behavior is somewhat bizarre.
When opening a xml document, multiple validation errors occur and the document does not open but another document "mydocument.myappxml.new" is created in the same directory as the original. The new unopened document has been correctly migrated.
When opening a sqlite document, the document opens without error but a another document "mydocument~.myappsqlite" is created in the same directory as the original.
Some developers have suggested placing Apple's options dictionary code for the persistent store coordinator in the application delegate. Refer to http://tinyurl.com/7jgknyk But this seems only to work for a specific store type. I need it to for all three store types, xml, sqlite, and binary.
Can anyone shed some light on this? Thanks.
--Richard
_______________________________________________
Cocoa-dev mailing list (Coco...@lists.apple.com)
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:
https://lists.apple.com/mailman/options/cocoa-dev/cocoa-dev-garchive-98506%40googlegroups.com
This email sent to cocoa-dev-ga...@googlegroups.com
> Can anyone shed some light on this?
It appears that others have also recently experienced frustration with automatic lightweight migration and have come up with zero answers.
Jan 26, 2012
Mar 20, 2012
> When opening a sqlite document, the document opens without error but a another document "mydocument~.myappsqlite" is created in the same directory as the original.
That is expected behavior. The "tildefied" document, as I call it (tilde = "~") is in fact the old document, prior to migration, which Core Data has renamed. It is an undocumented "feature" of Core Data. Apparently, the idea is that, with help from your Support Department, a distressed user can revert if the migration gave undesired results.
So it looks like your SQLite migration is working correctly. Only your XML migration is failing.