Deleting core data version xcdatamodel files

后端 未结 2 498
死守一世寂寞
死守一世寂寞 2020-12-14 06:57

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 shipp

相关标签:
2条回答
  • 2020-12-14 07:04

    Deleting the old models means you cannot migrate any existing data stores. I assume you're ok with that given your statement about data loss. If you want to start fresh, you can take the current xcdatamodel, copy it somewhere else (e.g. your Desktop), then delete the xcdatamodeld folder. At this point, you can drag your saved xcdatamodel back into Xcode and re-add it as a non-versioned file.

    0 讨论(0)
  • 2020-12-14 07:14

    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

    0 讨论(0)
提交回复
热议问题