Deleting core data version xcdatamodel files

Viewed 18433

I've created a versioned Core Data model in my iOS app, and it has several versions created so far (several .xdatamodel files within the .xcdatamodeld bundle). Before shipping the app, I'm considering deleting these old versions so I can start with a single clean data model - and data loss isn't an issue at this stage.

Is this possible? And what would be the best way to achieve this without simply deleting all Core data files and recreating a new model.

2 Answers

If you want to get rid of old versions of the data model

(Note: make sure you copy the Data model file and save it somewhere in case something goes wrong)

Five Step solution

  1. Select .xcdatamodeld file in Xcode, make sure you have the latest version is set as the current data model.
  2. Right, Click Show in finder if you don't see all your versions right click again and show package contents.
  3. Delete all the version except the latest.
  4. Jump back to Xcode and now delete the .xcdatamodeld file just remove reference don't move to trash.
  5. Add the file back again

Voila it's done

Related