Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode Data Model Editor not appearing

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?

like image 843
Sanjiv Jivan Avatar asked Dec 27 '11 16:12

Sanjiv Jivan


2 Answers

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

like image 91
Adam Ritenauer Avatar answered Nov 19 '22 01:11

Adam Ritenauer


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.

like image 2
Sid Steward Avatar answered Nov 19 '22 00:11

Sid Steward