views:

147

answers:

1

I am trying to migrate in core data using the automatic migration. The difference between the two versions is I added an additional attribute a model. When I attempt to add the PersistentStore to the coordinator I get the following exception

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Unrecognized column in entity'

If I remove the attribute the application loads fine (keeping the xcdatamodeld file set to the newer version or setting it to the earlier one.)

Any ideas on what could be causing this? Google turned up nothing.

A: 

What are your store options like? Mine are:

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

Also, make sure you are creating a new model version and adding your new attribute to that, and ensure that your previous model matches the current store. Are the only data models you have inside the xcdatamodeld file? And there are no others in your bundle?

Michael Waterfall
Plus, don't forget to create a mapping model to migrate between the two versions.
Elise van Looij
Those where the options I used. And I created a new entry in the xcdatamodeld. And set the version I wanted to use. It works if I create a MigrationManager and let that run.
joejackson