CoreData:错误:(迁移)迁移失败,错误(null)

时间:2013-10-23 16:50:54

标签: ios core-data migration mapping

我正试图了解核心数据迁移。

基本上,我们有15个数据模型,到目前为止,我们对inferMapping和autoMigration选项非常满意:

NSDictionary *lcOptions = [NSDictionary dictionaryWithObjectsAndKeys:
 [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption,
 [NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil];

现在我有一个要重命名的字段,一个要删除的关系和一个要创建的新关系。我选择了映射模型的东西,因为我认为它可以正常工作,但事实并非如此。

基本上,迁移一直持续到结束时说:

[Migration doing OK apparently]
2013-10-23 18:19:25.561 MyApp[80546:c07] CoreData: sql: SELECT 0, ....
2013-10-23 18:19:25.562 MyApp[80546:c07] CoreData: annotation: sql connection fetch time: 0.0004s
2013-10-23 18:19:25.562 MyApp[80546:c07] CoreData: annotation: total fetch execution time: 0.0008s for 2 rows.
2013-10-23 18:19:25.562 MyApp[80546:1b03] CoreData: annotation: Disconnecting from sqlite database.
2013-10-23 18:19:25.564 MyApp[80546:1303] CoreData: annotation: Disconnecting from sqlite database.
2013-10-23 18:19:25.564 MyApp[80546:c07] CoreData: annotation: (migration) leaving incompletely migrated store on disk after automatic migration failure. (file://localhost/Users/vdesaintpern/Library/Application%20Support/iPhone%20Simulator/6.1/Applications/1B73B767-2BFC-4716-B93B-E9CFA29952A8/Library/Application%20Support/.MyDatabase.sqlite.migrationdestination_41b5a6b5c6e848c462a8480cd24caef3)
2013-10-23 18:19:25.564 MyApp[80546:c07] CoreData: error: (migration) migration failed with error (null)
2013-10-23 18:19:25.564 MyApp[80546:c07] Unresolved error (null), (null)

- >崩溃

我的数据库位于库/应用程序支持中,它似乎完全可读/可写。

Core Data的“剩余”(.MyDatabase.sqlite.migrationdestination_41b5a6b5c6e848c462a8480cd24caef3)完全可读,似乎包含了我需要正确迁移的所有数据。

我已经多次尝试过,重新创建了映射模型,一次又一次地完成整个过程。没运气。

嗯,说实话,它上周工作了,而且它不再工作了(我查看了当我看到它工作时我提交的确切修订)。没有更改XCode或我系统中的任何内容。

我发现一个人在Mac上遇到同样的问题,但不幸的是,解决方法不适用于iOS。

非常感谢任何帮助。

0 个答案:

没有答案
相关问题