我想通过轻量级迁移迁移两个核心数据模型。不同之处仅在于,我删除了一些新模型中的实体,因为它们不再需要。CoreData:不能轻松迁移删除实体'没有这样的表'
当运行我的应用程序,一经推出,我收到以下错误信息:
CoreData: error: (1) I/O error for database at /var/mobile/Applications/E117D13D-C4DE-4F70-BBDB-F3F4E36A6A86/Documents/.Database.sqlite.migrationdestination_41b5a6b5c6e848c462a8480cd24caef3. SQLite error code:1, 'no such table: ZFLIGHTSTATUSSEARCH'
FlightStatusSearch
是我放弃了实体之一。我很确定我已经删除了几次实体,轻量级迁移就像魅力一样。我不知道我在这里可能会做错什么,因为它与我在这个应用程序中使用相同的核心数据实现了几年,现在没有任何问题。我在iOS7上运行。
错误消息在启动期间触发了几次。据我所知,每次我尝试与NSPersistentStoreCoordinator
进行交互时都会发生这种情况。
有没有人遇到类似的问题或知道这个错误是想告诉我什么?
UPDATE:
第一这个错误日志,呼吁-[NSPersistentStoreCoordinator addPersistentStoreWithType:URL:options:error:]
的存储类型是SQLite
发生时,配置Main
,这是围绕着用我的主要配置的名称应用程序,该URL指的是旧的,尚未迁移的数据库和选项是这样的:
NSDictionary* optionsDictionary = @{NSMigratePersistentStoresAutomaticallyOption: @YES,
NSInferMappingModelAutomaticallyOption: @YES};
使用的模型当实例化协调器不包含包含FlightStatusSearch
模型时,错误消息指的是。
更新2
这是堆栈跟踪:
#0 0x389c16a0 in objc_exception_throw()
#1 0x2e4178aa in -[NSSQLiteConnection prepareSQLStatement:]()
#2 0x2e4d0c08 in -[NSSQLConnection prepareAndExecuteSQLStatement:]()
#3 0x2e50c66e in -[_NSSQLiteStoreMigrator performMigration:]()
#4 0x2e505fa4 in -[NSSQLiteInPlaceMigrationManager migrateStoreFromURL:type:options:withMappingModel:toDestinationURL:destinationType:destinationOptions:error:]()
#5 0x2e4bcb96 in -[NSMigrationManager migrateStoreFromURL:type:options:withMappingModel:toDestinationURL:destinationType:destinationOptions:error:]()
#6 0x2e4fe3f0 in -[NSStoreMigrationPolicy(InternalMethods) migrateStoreAtURL:toURL:storeType:options:withManager:error:]()
#7 0x2e4fd6f8 in -[NSStoreMigrationPolicy migrateStoreAtURL:withManager:metadata:options:error:]()
#8 0x2e4fec5e in -[NSStoreMigrationPolicy(InternalMethods) _gatherDataAndPerformMigration:]()
#9 0x2e40b0ba in -[NSPersistentStoreCoordinator addPersistentStoreWithType:configuration:URL:options:error:]()
#10 0x001dca70 in -[CoreDataManager persistentStoreCoordinator] at /Users/michael/Projects/12_IP_MyProject/Components/CoreData/CoreDataManager.m:160
#11 0x000afed0 in -[AppDelegate init] at /Users/michael/Projects/12_IP_MyProject/MyProject/Classes/AppDelegate.m:86
#12 0x30eb2190 in UIApplicationMain()
#13 0x000af9d4 in main at /Users/michael/Projects/12_IP_MyProject/MyProject/Supporting Files/main.m:16
#14 0x38ebaab6 in start()
问候, 迈克尔
数据库最初是由Core Data创建的吗? – eofster
是否有可能迁移完成,但是您不知何故尝试使用旧模型访问新的商店?在调用哪些方法到底会发生错误? – eofster
感谢您的反馈,我更新了我的问题。 @eofster是的,这个数据库是由CoreData在首次启动应用程序时创建的。 –