2

I am stuck with xcdatamodel being corrupted. I am a newbie and have no clue what to do hereon. Can supply the file which is being questioned alongwith the sqlite db as well...

Do not know what do as I am quite literally brain frozen.. pls help.

TIA

techster
  • 41
  • 3

2 Answers2

0

I've just had the problem.

I had a time machine so I was able to import it again to xcode but it didn't work. Investigated the package "myapp.xcdatamodeld" imported by xcode, there was only the ".xcccurrentversion" file, but not the "myapp.xcdatamodel" file. I copy pasted the missing file in the package (right clic / show package content) and it worked.

moxy
  • 1,634
  • 1
  • 11
  • 19
0

I just had the same issue. In my case, I was moving files in my workspace into sub folders and pointing the groups at the subfolders. I believe this caused the corruption.

Unfortunately I don't have an answer - although I tried a lot of things. Restoring a backup of the file over top the corrupted one didn't work. The xcdatamodel file must be have self-references of some kind. If you open it as a package and then open what's inside as a package, you'll see 2 files: "elements" & "layout". If you copy these out and rename them to have a .plist extension you can see what's inside. Its a pretty tough slog through those plists (looks like an object archive) but you may see something obvious.

In the end I restored my entire project directory to a new location, opened the project and was able to cut and paste the entities over to a brand new data model. Thank god for Time Machine!

Matt__C
  • 319
  • 2
  • 10