Transfer master data from multiple versions

Problem

  • I got 4 versions of the underlying data model (easy migration)
  • In version 5, you must manually create a mapping model (change the data type from nsnumber to nsstring)
  • Migrating from v4 to v5 works fine with the mapping model, but for a user with a different version (1-3), how do I handle this migration?

I read some SO post Core Data Migration error when migrating between endless versions and try to use progressive migration , but it does not work with a clean installation, because inprogressivelyMigrateURL:

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:inaccessible

Do I need to change something to make this work?

, , , , , t .

+5

All Articles