Basic Core Data model versioning

When you add new properties, entities, relationships to an existing data model which is already deployed in production, this will fail with this error:


Therewith this does not happen, some steps are necessary. At first, you need to configure Core Data, that data is migrated automatically:

The second step is, to create a new version of the data model for a change. To do this, select the .xcdatamodeld file in your project navigator. Then in the menu, select Add model Version….

create_new_model_versionIn the next dialogue, type in an appropriate version name and click Finish.




Before you start to modify the model, select the xcdatamodeld file again
and in the file inspector,
select the current model version.