Xcode Data Model Editor not appearing

点点圈 提交于 2019-12-08 15:44:43

问题


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.

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?


回答1:


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




回答2:


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.




回答3:


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.




回答4:


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

That fixed it for me! :)




回答5:


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.



来源:https://stackoverflow.com/questions/8646800/xcode-data-model-editor-not-appearing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!