XCode crashes when trying to view an .xcdatamodel

北慕城南 提交于 2019-12-22 10:44:58

问题


I have an app, backed by Core Data, that I've been working on for awhile. I use version control (formerly SVN, now Git) to move it around between different Macs.

The other day, I was unable to open the project. OH CRAP. Luckily, due to Time Machine I was able to go back in time, and reverted to an earlier version. I suspected that something with either the XCode project files or the Core Data files was at play here (I ran into some of the problems that this guy did, I guess), but everything seemed to be working so I moved along.

But now, I realized that when I try to open the .xcdatamodel file in XCode, I can't. It just hangs and then I wind up Force quitting. Aside from that though, the app works totally fine. I can deploy it to the simulator or a device and it works. But I don't know how I have any hope of editing. Any tips on what I can do to fix this?


回答1:


I was right now in the same situation, but when I've a close look to my model file raw text I saw all elements with strange attributes regarding screen rect

<element name="myEntity" positionX="0" positionY="0" width="0" height="0"/>

so I change this to

<element name="myEntity" positionX="10" positionY="10" width="128" height="240"/>

for all the entities. This did the trick, now I'm able to open to model file again in Xcode.




回答2:


In the end, I wound up deleting the model file in XCode and rewriting it. Luckily it didn't take very long. If anybody else has a different suggestion on how to fix a corrupted model file please chime in and I can mark your answer as accepted.



来源:https://stackoverflow.com/questions/4695307/xcode-crashes-when-trying-to-view-an-xcdatamodel

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