简体   繁体   中英

Core Data model versioning, don't have xcdatamodeld file

In my project I don't have xcdatamodeld file instead I have Model.xcdatamodel file only. I don't how it happens, and now the app is already ship to store. So, is there a way I can add model versioning. Please help.

Use the Xcode menu item that adds model versioning.

在此处输入图片说明

Thats how I solve my problem. What happen was I used older Xcode version, I don't know which one, but it created xcdatamodel file, I checked Xcode 6 create xcdatamodeld file by default. And reading further, I came to know in earlier version first time it create xcdatamodel file and when you add model version, it automatically converts to xcdatamodeled file. When I try the same thing in Xcode 6 it replaced the xcdatamodel file with new xcdatamodeld file but it doesn't maintain any core data entity or anything, it just shows empty file.

So, to solve this problem this is what I did, I created a backup of my model.xcdatamodel file. I deleted it from my project and finder. Then I created a new core data file with same name, and it creates model.xcdatamodeld file. Then I open its packages and copy the contents file from model.xcdatamodel to model.xcdatamodeld, and it works.

To verify it, I download my app store release, add some caching, and then update that with my Xcode version, and it maintains the database, and now I have xcdatamodeld file, so I can easily add new version.

Will going to do some more testing with test flight builds to see if it works fine or not, but so far no issues.

Hope, it helps others too.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM