Figured I'd post a complete question/answer here to the known bug:
When upgrading to Xcode 7 (stable/beta) from a previous release, your build suddenly gives you a new warning: "Missing current version declaration" for your CoreData model file.
Worst of all, double-clicking this warning goes nowhere, & there are no obvious hints within Xcode as to the resolution. How do you resolve this issue?
Note: This was tested on Xcode 6.4 & Xcode 7 beta 3 - As of Xcode 7 beta 4 there appears to be a built-in solution, and manually creating the file no longer works - see accepted answer
Open up Terminal, and navigate to your project directory & model file - your command should look something like this:
cd /Users/YOU/Documents/MyProject/MyProject/MyDataModel.xcdatamodeld
Now list all the contents of your data model directory:
ls -la
If you don't see a file called ".xccurrentversion", it needs to be created.
nano .xccurrentversion
Copy/paste the needed 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 (e.g. MyDataModel.xcdatamodeld --> MyDataModel).
Now, likely you'll need to fix the permissions for the file:
chmod 775 .xccurrentversion
.. which is sufficient.
Clean the project, restart Xcode, rebuild - warning should go away.
Largely compiled from this thread, with some more specificity + permissions fix: https://forums.developer.apple.com/thread/8861
While in Xcode’s Core Data model editor, in the menu bar select Editor -> Add Model Version.
Then in the version name
you are free to specify what you like, you can just type in your model name. (verified on Xcode 7 beta 4)
(This will result in creation .xccurrentversion in your data model bundle)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With