Frage

I am trying to migrate two Core Data models through lightweight migration. The differences are only, that I removed a bunch of entities in the newer model as they are not needed anymore.

When running my application, upon launch, I get the following error message:

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 is one of the entities I dropped. I am pretty sure I have deleted entities a couple of times and lightweight migration worked like a charm. I have no clue what I could do wrong here as it is the same core data implementation I have used in this app for a couple of years now, without any problems. I am running on iOS7.

The error message is triggered a couple of times during launch. As far as I can tell, this happens every time I am trying to interact with the NSPersistentStoreCoordinator.

Has anybody experienced a similar issue or knows what this error is trying to tell me?

UPDATE:

The first of this error logs occurs when calling -[NSPersistentStoreCoordinator addPersistentStoreWithType:URL:options:error:]

The store type is SQLite, the configuration is Main, which is the name of my main configuration that is used around the app, the URL refers to the old, not yet migrated database and options is this:

NSDictionary* optionsDictionary = @{NSMigratePersistentStoresAutomaticallyOption: @YES,
                                    NSInferMappingModelAutomaticallyOption: @YES};

The model that is used when instantiating the coordinator does not contain the FlightStatusSearch model, the error message is referring to.

UPDATE 2

This is the stack trace:

#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 ()

Best regards, Michael

War es hilfreich?

Lösung

I figured this out.

I forgot to drop one entity with the following environment:

Class A inherits from Class B, Class A represents the entity I forgot to drop, Class B has been a Core Data entity but was converted to a non-coredata model. Now there was an entity that inherited from a non-coredata model. This results in the error message I mentioned above. The table that is mentioned there was the table from Class B, which has been an entity, but isn't anymore. As soon as I dropped Class A from the model, too, everything worked.

Thanks for your help.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top