Reputation: 2113
i am having some issues with Core data migration. i am having 3 versions of my app 1.0, 1.1, 1.2.
for the 1st two versions(1.0 and 1.1), i am having the same data model, but for third version(1.2) i have done some changes in my data model. Now i am getting incompatible issue at version 1.2 of my app(though its a light weight changes).
I am thinking that i have missed the data model version at version 1.1 of my app, as there is no change in the datamodel for 1.0 and 1.1, i havent created another data model version.
Do we need to create a data model version for new app version, even there is no change in the data model between the versions.
sorry if my query is too dum... please suggest..
Upvotes: 1
Views: 778
Reputation: 2113
If you want to change the model but also retain the ability to open stores created using a previous version of the model, you must keep the previous version of the model (as a version in a versioned model). Core Data cannot open a store for which it has no compatible model. Thus, if you want to change the model but also retain the ability to open existing stores, you must:
Please refer the link for step by step procedure of versioning
Upvotes: 1
Reputation: 7153
No, you don't need to have a data model version for each app version.
Just to be sure: when you went from 1.1 to 1.2, did you create a new data model version? Or did you simply modify the existing data model? Because for (lightweight) migrations to work, you're supposed to have different versions of the data model; you should NOT just modify the existing model.
Also, you did write the code to perform the automatic lightweight migrations, right?
Upvotes: 1