Core data model file is complaining of "Missing current version declaration". It's not clear in Xcode 7 beta 3 how to silence this warning. Even deleting the app from device/simulator shows the same issue. Anyone know where Xcode wants to have this value input?
Xcode 7 beta 3: Missing current version declaration
I am having this issue as well. My best guess was putting something in the Model Identifier field, but that had no affect.
I am getting this warning too. Not sure what the remedy is
+1 I'm seeing same warning.
Same here
Check your .xcdatamodeld bundle. There should be a file named .xccurrentversion in there. If it isn't, add one and the warning should go away.
Here's how the directory structure and file should look like.
matej@RetinaBook Test.xcdatamodeld ⟩ l
total 8
drwxr-xr-x 4 matej staff 136B 10 jul 11:35 .
drwxr-xr-x 14 matej staff 476B 10 jul 11:35 ..
-rw-r--r--@ 1 matej staff 257B 10 jul 11:35 .xccurrentversion
drwxr-xr-x 3 matej staff 102B 10 jul 11:35 Test.xcdatamodel
matej@RetinaBook Test.xcdatamodeld ⟩ cat .xccurrentversion
<?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>Test.xcdatamodel</string>
</dict>
</plist>
Hmmm... If I "Show Package Contents" from the Finder for my .xcdatamodeld file, i Just see only one file/directory - "contents" . What am i Missing?
contents should be inside your xcdatamodel (not xcdatamodeld). At least that's the case for me and what I got when creating a new project.
I also created a new model file using XCode 7 Beta 3 and it has the same format (aka. just "contents" inside .xcdatamodeld file). Maybe they are transitioning a new simplified modelld file format and this warning is an oversight???
Nota Bene
Updated the correct solution which is:
- Open the Data Model in Xcode
- Select Editor > Add Model Version...
- Type in your Model Filename (default on mine was xxx 2, which I changed to xxx)
This is one workaround but the implementation needs some explaining. Here is how I took this information and fixed my particular issue.
- Went to the directory where the file is located in Terminal (Note: this would be /projectname/projectname)
- Since the file is a package I just changed directory to examine the contents
cd projectname.xcdatamodelld
- To examine all entries (including hidden files) in the target folder mentioned
ls -a (NOTE: a folder called contents exists in a subfolder; if you see this then you've gone one folder too deep)
- Add the suggested file .xccurrentversion using:
touch .xccurrentversion (One can also use any editor to create the file)
- Opened the file using an editor of my choice (Any text editor will do)
nano .xccurrentversion
- Pasted in the contents (one must change the file name to match your model file - line 06.)
<?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>projectname.xcdatamodel</string> </dict> </plist>
- Save the new file (Note: this would be /projectname/projectname/projectname.xcdatamodeld/.xccurrentverion)
- Clean, close, and reopen the project
- Added the resolution to the bug report that I filed on this matter (21751666)
Thanks for documenting the steps to fix. Note that your xml is a little bit muddled with the <span> tags though in this post. I took the xml from your first post and that worked great!
@Matej, You are right. I stand corrected. Actually i was looking one level deeper than I thought 😟
In any case, just as you suggested, I created the file ".xccurrentversion" with your xml content (modified only to reflect the value of the name of the .xcdatamodel file in my project) - But I still get the same warning. I rechecked multiple times and everything matches per your recommendation. Am I missing something?
Contents of .xccurrentversion @ .../MyProject.xcdatamodeld/
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-/
<plist version="1.0">
<dict>
<key>_XCCurrentVersionName</key>
<string>MyProject.xcdatamodel</string>
</dict>
</plist>
Perhaps a clean build / clean build folder?
I did that. Also I quit xcode and deleted the entire .DerivedData folder and made an extra clean build and I still get the same warning 😟
Nota Bene
Updated the correct solution which is:
- Open the Data Model in Xcode
- Select Editor > Add Model Version...
- Type in your Model Filename (default on mine was xxx 2, which I changed to xxx)
Work Around:
I have found that the recommended solution works under OSX 10.10.4 running Xcode 7 beta 3 but NOT under 10.11 Beta (15A216g) running Xcode 7 beta 3. I am still unsure why and suspect that something more must be in play. Anyone have this issue resolved under 10.11. Beta?
I even went so far as to create a new model file in El Capitan:
When first added, the mew model file (with no entities), there was no issue
Next I copied the entites from the old file and pasted them into the new one (issue appeared again)
Actually two things happened.
The Delete Action Rule was not copied correctly for the relationships
The original error also reappeared.
The original solution did not resolve the error on this machine.
So, I think we may be missing something further.
Ah. Same here . I am running El Capitan and also tried creating a brand new data model. Didn't work.