7

Can anyone help 'cos this is driving me nuts!

I have an app I am at the early stages of and it has a Data Model. So far it has only 5 entities and a few relationships.

Up to now I have not been using versioning, just deleting the app from my iPad and reloading it when I make changes to the schema. This has worked fine up to now as I have changed the schema a couple of times.

SO this morning I tried to add a new entity with a relationship to an existing entity in the model. All seemed fine until I went back to inspect the model. The graph view is all screwy. Relationships are missing, the arrows point to empty space, and the layout is not how I saved it...

Deleting the new entity restores things to normal. Or appears to.

I can add the entity with no issues but as soon as I try and add the relationship it gets messed up. I think than the model itself is OK, just the graphic representation is mucked up.

I have tried creating a new version, setting that to current, editing it and the same result each time... I can't see anything to solve it.

This is my first time using core data so maybe it's something dumb on my part but I'm pretty sure I'm doing the exact same thing I did for the other 4 entities.

Help PLEASE!

Bertie
  • 520
  • 1
  • 6
  • 15
  • 4
    Not your fault. The graphic model editor is just buggy. If the graphical editor has glitches try to click the little expansion triangles before Relationship or Attributes. That usually fixes the layout. At least for the next couple minutes. I would try to stay within the table editor. ;-) And [report bugs](https://bugreport.apple.com). So annoying, especially if you are new to coredata you need the graphical editor to understand your model. – Matthias Bauch Apr 05 '12 at 09:58
  • Thanks. I'll just chalk the last few hours down to "Apple Time" then! So annoying. It's not such an issue with this smaller model but I have another model in the app that I'm still sketching out that has about 50 entities and loads of relationships... that might test my brain! – Bertie Apr 05 '12 at 10:18

1 Answers1

24

Here is a little hack to fix this display bug in Xcode, which is typically due to corrupted data in YourApp/YourApp.xcdatamodeld/YourApp.xcdatamodel/layout.

After quitting Xcode or closing the project, you can just delete this file (did not always work for me, sometimes the file is not there).

Alternatively, you can edit the file contents in the same directory and simply delete the whole section labeled <elements> .... </elements>. Your entities will all be on top of each other in the editor, but it should work now after rearranging them.

Mundi
  • 79,884
  • 17
  • 117
  • 140