Frage

We have an app that it's already in production with a Core Data model that we need to replace. There has been a lot of changes in our server side and we want to update the model to reflect those changes and new functionalities.

Instead of performing a custom Core Data migration we're discussing about creating another model from scratch and get rid of the old one. We do not need to persist any of the existing data in our actual model because it's all available in our server, so when the user needs it again the app will download it when requested.

Is it possible to create a new model, tell the app to use it and safely delete the old one? Are there any other options to solve this problem?

War es hilfreich?

Lösung

You can have as many models as you want. If you are using Apple's template for Core Data Stack, then you should alter managedObjectModel and persistentStoreCoordinator to reflect new name for your model and file.

If you don't need any of the legacy data locally then modifying these 2 methods after preparing you new model with new model name should be enough.

Another option is to auto-migrate your existing data through new model version, but it does seem to be required in your case.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top