Xcode Data Model Editor not appearing
Asked Answered
A

5

10

I'm using Xcode 4.2 and I'm trying to use Core Data. Upon clicking the .xcdatamodeld file I see a strange view instead of the Data Model Editor View.

Data Model Editor

I have reinstalled Xcode 4.2 and have even created a starter project from scratch with Core Data Enabled but the issue persists. When I create a Data Model using new file --> Data Model. It is not being recognized as a DataModel. Ctrl+Click --> 'Open As' only displays a "Preview" option. I compared my basic project with that created on a different machine (where everything works fine). A directory diff reveals :

  1. The Foos.xcdatamodeld file was placed under the "Copy Bundle Resources" section of the project's Build Phase instead of being under the "Compile Sources" section. I moved this file to the "Compile Sources" section but the data model editor still doesn't display.

  2. The Foos/Foos.xcdatamodeld/.xccurrentversion file in the working project looked like


<?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>Foos.xcdatamodel</string>
</dict>
</plist>

while in the non-functional one it was


<?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>
</dict>
</plist>
  1. The only other difference I noticed was that the working version had the following in the project.pbxproj file

/* Begin XCVersionGroup section */
      831B12C114A7F73600524A33 /* Foos.xcdatamodeld */ = {
         isa = XCVersionGroup;
         children = (
            831B12C214A7F73600524A33 /* Foos.xcdatamodel */,
         );
         currentVersion = 831B12C214A7F73600524A33 /* Foos.xcdatamodel */;
         path = Foos.xcdatamodeld;
         sourceTree = "";
         versionGroupType = wrapper.xcdatamodel;
      };
/* End XCVersionGroup section */

while the broken one did not have this entry.

I did a directory compare of /Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates on my two machines and the templates are identical.

So I'm wondering what part of Xcode is causing the above differences on my primary dev machine. Any suggestions on things to try or what might be causing this issue?

Anthologize answered 27/12, 2011 at 16:20 Comment(5)
were you able to solve this, I also can't open a coredata model fileHowland
Unfortunately not. I used my other Mac laptop to create the initial model and copied it over to my primary dev machine and this opens fine.Anthologize
I pretty much had to create a new project and copy over the modelHowland
Had the same issue when I added a folder reference with model inside. I managed to solve that adding xcdatamodeld file separately. Maybe it's somehow connected to version control, but nothing helped except removing reference to xcdatamodeld file and adding it separately.Teaser
If you change the file type to be Versioned Core Data Model explicitly (rather than it being the default setting) does it help? (I used to have a similar problem with .nib/.xib files, where I had to explicitly set the file type for Interface Builder, otherwise they would come up as XML-type code.)Valor
M
6

I ran into a similar issue. The problem was the projects directory structure and how it was configured in XCode.

More details here: XCode Cant' Edit CoreData Model

Mcbride answered 6/12, 2012 at 14:48 Comment(0)
R
1

I also ran into this.

I was finally able to get xcode 4.6.3 to restore the interactive editor by opening the .xcdatamodeld in my project and changing the File Type (in the file inspector) from Versioned Core Data Model to Core Data Model. I was able to change it back to Versioned Core Data Model, later, and things kept working.

Robertson answered 29/8, 2013 at 17:43 Comment(0)
A
0

I had the same problem, but by creating another user account on my Mac, I was able to create a project with Core Data where the editor opens normally. It appeared my user profile was corrupt and it couldn't be resolved by reinstalling Xcode.

Antho answered 30/8, 2014 at 22:58 Comment(0)
O
0

When creating a new data model, go to Editor > Add Model Version

That fixed it for me! :)

Oeflein answered 5/4, 2016 at 3:30 Comment(0)
M
0

I solved the problem by opening the package contents of xcdatamodeld, dragging out the file inside with the same name and using it instead, thanks to this answer.

Marrero answered 26/3, 2017 at 23:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.