Testimonial
You reached the Coding and Lab World of Zero-One. You get Information about current projects and closed as well.
If you are working on your project in XCode you will mostly use CoreData to handle the whole Data stuff. For this you designed a DataModel. Especially in the beginning of your project you need to change Attributes etc. very often in your DataModel.
After changing something in your DataModel and build the project you will be faced with e message, that tells you something about an incompatible persistensstore.
Your need to remove your serialized Data from your Harddisk and enter all your Testdata again.
CoreData can handle small changes in de DataModel by itself. You just need to activate this first.
- (NSPersistentStoreCoordinator *) persistentStoreCoordinator {
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption, [NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil];
if (![persistentStoreCoordinator addPersistentStoreWithType:NSXMLStoreType configuration:nil URL:url options:nil error:&error]){
and change the options attribute to the following:
if (![persistentStoreCoordinator addPersistentStoreWithType:NSXMLStoreType configuration:nil URL:url options:options error:&error]){
Apple has a very good CoreData Migration whitepaper . This can be found here.