Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode data model problems with appearance in editor

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!

like image 391
Bertie Avatar asked Apr 05 '12 09:04

Bertie


1 Answers

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.

like image 94
Mundi Avatar answered Nov 15 '22 09:11

Mundi