Abdul Rahman
Abdul Rahman

Reputation: 986

If I upload a next version of ios app in app store, is my Old data will be deleted

I have one clarification, If I had upload a first version 1.0 of my app in ituenes app store and that app 100 users have been downloaded and using it, after one month I have added some extra features in the same app and uploading a next version eg: 1.2

Then The 100 users who have already using those application has been updated the next version.

My question is : In the first version if they have saved their data in 1. Nsuser Default 2. Core Data

Will it be deleted when updating the next version.

What will be the process, Some one could be explain.

Upvotes: 0

Views: 76

Answers (1)

Fogmeister
Fogmeister

Reputation: 77631

When using Core Data if you have made changes to the data model then there are several possibilities.

First, if you don't do anything and just update the data model then when the update is applied to existing installs the app will crash when trying to access CoreData data. This is because the model it is expecting is different from the one in the database.

Second, you could get around this by manually deleting the core data store and setting up a new one. This will also get rid of all the data so possibly not a good solution.

Third, you can update your CoreData model version number. Instead of just changing the data model create a new version of the data model from the existing one.

Now, when the app detects that the data model and data do not match (like in the first version above) it will migrate the data from the old to the new version. Sometimes this is possible automatically but it may require some additional code from you to help it along.

This site goes into how the migration works... https://www.objc.io/issues/4-core-data/core-data-migration/

Upvotes: 2

Related Questions