Problem
- I got 4 versions of core data model (light weight migration)
- In version 5 it need to be manually create mapping model(Change data type from nsnumber to nsstring)
- migrate from v4 to v5 work fine with mapping model, but for user with different version (1 - 3) how do I handle this migration ?
I have read some SO post Core Data Migration error when migrating between non-consecutive versions and try to using progressive migration mentioned there, but it fail on clean install because in progressivelyMigrateURL:
NSDictionary *sourceMetadata =
[NSPersistentStoreCoordinator metadataForPersistentStoreOfType:type
URL:sourceStoreURL
error:error];
if (!sourceMetadata) return NO;
and in - (NSPersistentStoreCoordinator*)persistentStoreCoordinator;
if (![self progressivelyMigrateURL:url
ofType:NSXMLStoreType
toModel:mom
error:&error]) {
[[NSApplication sharedApplication] presentError:error];
return nil;
}
//END:progressivelyMigrateCall
//START:persistentStoreCoordinator
if (![persistentStoreCoordinator addPersistentStoreWithType:NSXMLStoreType
configuration:nil
URL:url
options:nil
error:&error]) {...}
which make addPersistentStoreWithType:
unreachable
Do I need to change anything to made this work ?
Don't sure if I need to do all this work because I have read some comment here stated that core data do all this hard work automatically, but can't find any document yet.