Hello, I need to implement manual migration in order to chain migrations. I have compiled every mapping model from a version to the next one. All my models are included in my resources (in a .momd bundle). My code determines the model version used to create the document metadataForPersistentStoreOfType:URL:error: and isConfiguration:compatibleWithStoreMetadata:. with success. Once the version is determined, I determine the migration path using the model name (if I have found that the document is using model A, and that current is C, I now I should use AtoB and then BtoC mapping models). Once I have manually got my file to be migrated, source model, destination model, mapping model. I cannot successfully migrate using NSMigrationManager.
I have configured NSMigrationManager following the steps described in Core Data Migration Programming Guide - Customizing the Migration Process: NSMigrationManager *mManager = [[NSMigrationManager alloc] initWithSourceModel:srcModel destinationModel:destModel]; NSString *storePath = [NSTemporaryDirectory() stringByAppendingPathComponent:@"(A document being migrated)"]; if ([[NSFileManager defaultManager] fileExistsAtPath:storePath]) { // Removing previous item because unless, core data will try to append data rather overwriting [[NSFileManager defaultManager] removeItemAtPath:storePath error:&error]; } NSURL *storeURL = [NSURL fileURLWithPath:storePath]; NSURL *backupURL = [NSURL fileURLWithPath:[[[storePath stringByDeletingPathExtension] stringByAppendingString:@"~"] stringByAppendingPathExtension:[storePath pathExtension]]]; [mManager migrateStoreFromURL:URL type:nil options:0 withMappingModel:mModel toDestinationURL:storeURL destinationType:nil destinationOptions:0 error:&error]; if (error) { NSLog(@"An error occured while manually migrating document: %@", error); NSLog(@"UserInfo: %@",[error userInfo]); } The process fails here and the log then contains the following: An error occured while manually migrating document: Error Domain=NSCocoaErrorDomain Code=134110 UserInfo=0xf336960 "An error occured during persistent store migration." [6871:813] Error: { reason = "Can't add source store"; } I don't understand what does mean Can't add source store, and how should I configure my Migration Manager to perform my migration successfully. Does anyone can explain to me what is happening ? Thanks in advance Yvan BARTHELEMY _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com