1

I had a running Project which worked fine before push it to remote origin. Now I formatted my disk and checked out this project an I get the Error:

_MyModelDB 3.xcdatamodel: Failed to read data model Error Domain=NSCocoaErrorDomain Code=256 "The file “contents” couldn’t be opened." UserInfo={NSFilePath=ProjectPath/Model/DBModel/MyModelDB.xcdatamodeld/._MyModelDB 3.xcdatamodel/contents, NSUnderlyingError=0x7fba9b6245d0 {Error Domain=NSPOSIXErrorDomain Code=20 "Not a directory"}}

There is indeed no ".content" for the last versioned dbmodel. And the size of _MyModelDB 3.xcdatamodel is strangely 0KB.
Somebody an Idea ??

feldeOne
  • 417
  • 3
  • 18
  • 1
    Sounds like your model contents were never checked in. – Avi Apr 18 '16 at 06:19
  • I took a look to my git Log and I could even see where and when I checked the Project in. But it has 0KB – feldeOne Apr 18 '16 at 06:34
  • I wonder if I have to build the newest XCDatamodell a second time or if there is way where Xcode can Manage such work. – feldeOne Apr 18 '16 at 07:54
  • `contents` *is* the model definition. If you don't have that, you don't have a model. – Avi Apr 18 '16 at 07:56
  • So should I remove the file MyModelDB 3.xcdatamodel and make a new one ? And what is the best Approach – feldeOne Apr 18 '16 at 07:59
  • 1
    You probably have to. I would look at your model objects and reverse-engineer the model from those. I hope you don't have to migrate anything, as you no longer have the previous model to work with. – Avi Apr 18 '16 at 08:11
  • 1
    This isn't really a Core Data question. You lost a file somehow. You can either re-create it or restore it from git or from your backups. It'd be the same for any missing file. – Tom Harrington Apr 18 '16 at 17:28
  • @HermannKlecker , Yes I could fix the problem but it is not the best solution. The Problem was indeed the empty xcdatamodel.I just removed the latest XCDatamodel with all content and created a new xcdatamodel version. I still had all the modell Classes so I just could rebuild my xcdatamodell by reverse engineering. – feldeOne Jul 26 '16 at 07:19
  • All right. That does not help me as I am using KVC only and don't have any model classes. – Hermann Klecker Jul 26 '16 at 14:37

1 Answers1

0

This happened to me also. I deleted the contents file for a data model version, and couldn't build.

The model version I deleted wasn't in the current version of the project.pbxproj file. I never pushed it up.

So I moved the entire project directory to the trash and downloaded everything fom github. Now the build works.

flhhc
  • 19
  • 4