我希望你能帮助我。 我有三个型号版本V1,V2和V3(当前型号)。 因此,我有两个映射模型V1to2 V2to3 我也启用了NSMigratePersistentStoresAutomaticallyOption。两种映射模型的核心数据迁移
当我用V2商店启动我的应用程序时,它已成功迁移到V3。 但是,当我开始我的应用程序与V1商店的应用程序崩溃,因为没有映射模型发现:
NSDictionary *optionsDictionary = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:NSMigratePersistentStoresAutomaticallyOption];
if (![psc addPersistentStoreWithType:NSSQLiteStoreType
configuration:nil
URL:storeURL
options:optionsDictionary
error:&error]) {
[NSexception raise:@"Open failed" format:@"Reason: %@", [error localizedDescription]];
}
我试图改变目前的模式,V2和它的作品,它从V1toV2成功迁移。 之后,我刚刚将当前模型更改回V3并再次展示应用,并成功从V2toV3迁移。
但是我错了,这个迁移不会自动运行,先自动运行V2toV2,然后自动运行到V2toV3?
非常感谢您的期待。 Flo