3

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?

Community
  • 1
  • 1
bpapa
  • 21,409
  • 25
  • 99
  • 147
  • Are all the Xcodes on your Macs up to date? – BoltClock Jan 14 '11 at 20:03
  • Yes, although now that I think of it this did start happening just after installing the 4.3 beta (which I installed in a different directory and haven't really used yet). – bpapa Jan 14 '11 at 20:05

2 Answers2

4

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.

  • I was about to remove CoreData from my app, but your tip solved (this) problem. CoreData thanx you, I'm still a bit hesitant :) – JOM May 07 '12 at 12:07
  • Thanks, worked like a charm. You can't change the width/height in Xcode, so eventually you may want to change the width and height based on what looks good (240 height for an entity with 1 attribute is way too high, for example). – Scott Berrevoets Jun 20 '12 at 05:56
1

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.

bpapa
  • 21,409
  • 25
  • 99
  • 147