Upgrading to Xcode 7 generates a "No current version version" warning on CoreData

Understood that I would pose a complete question / answer to a known error:

When upgrading to Xcode 7 (stable / beta) from a previous version, your assembly unexpectedly gives you a new warning: "There is no current version announcement" for your CoreData model file.

Worst of all, double-clicking on this warning is no good, and there are no obvious hints about resolution in Xcode. How to solve this problem?

+7
ios objective-c xcode core-data
source share
2 answers

In the Xcodes master data model editor, on the menu bar, select Editor → Add Model Version.

enter image description here

Then in the version name you can indicate what you like, you can simply enter the name of your model. (tested on Xcode 7 beta 4)

(This will create .xccurrentversion in your data model bundle)

+7
source share

Note. This was tested on Xcode 6.4 and Xcode 7 beta 3. As with Xcode 7 beta 4, there seems to be a built-in solution, and manually creating the file no longer works - see accepted answer

Open a terminal and go to the project directory and model file - your command should look something like this:

 cd /Users/YOU/Documents/MyProject/MyProject/MyDataModel.xcdatamodeld 

Now list the entire directory contents of your data model:

 ls -la 

If you do not see a file named ".xccurrentversion", you must create it.

 nano .xccurrentversion 

Copy / paste the required XML for the model version:

 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>_XCCurrentVersionName</key> <string>YOURDATAMODELNAME.xcdatamodel</string> </dict> </plist> 

Replace YOURDATAMODELNAME with the name of the data model directory, minus the extension (for example, MyDataModel.xcdatamodeld -> MyDataModel).

Now, probably, you will need to fix the permissions for the file:

 chmod 775 .xccurrentversion 

.. This is enough.

Clean the project, restart Xcode, rebuild - the warning should disappear.

Largely compiled from this thread, with some additional restrictions + permissions: https://forums.developer.apple.com/thread/8861

+10
source share

All Articles