8

After updating to XCode 7 in order to support iOS9 I had the following build error

error: Cannot read bundle contents (Error Domain=NSCocoaErrorDomain Code=260 "The folder “VoIP.xcdatamodeld” doesn’t exist.

Build target myTitle of project myTitle with configuration Debug

DataModelCompile Build/Products/Debug-iphoneos/myTitle.app/ /Users/myself/MyDev/m1/app/VoIP/VoIP/VoIP.xcdatamodeld cd /Users/myself/MyDev/m1/app/app/iPhone export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Applications/Xcode.app/Contents/Developer/usr/bin/momc --sdkroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk --iphoneos-deployment-target 7.0 --module myTitle /Users/myself/MyDev/m1/app/VoIP/VoIP/VoIP.xcdatamodeld /Users/myself/MyDev/m1/app/app/iPhone/Build/Products/Debug-iphoneos/myTitle.app/

/Users/myself/MyDev/m1/app/VoIP/VoIP/VoIP.xcdatamodeld:: error: Cannot read bundle contents (Error Domain=NSCocoaErrorDomain Code=260 "The folder “VoIP.xcdatamodeld” doesn’t exist." UserInfo=0x7fd0f350f990 {NSFilePath=/Users/myself/MyDev/m1/app/VoIP/VoIP/VoIP.xcdatamodeld, NSUserStringVariant=( Folder ), NSUnderlyingError=0x7fd0f350f940 "The operation couldn’t be completed. (OSStatus error -43.)"})

How can I resolve it?

The only reference about this file in my project is this one (in the .project file)

/* Begin XCVersionGroup section */
                449367DE1338E89100DB4AC9 /* myTitle.xcdatamodeld */ = {
                        isa = XCVersionGroup;
                        children = (
                                449367DF1338E89100DB4AC9 /* VoIP.xcdatamodel */,
                        );
                        currentVersion = 449367DF1338E89100DB4AC9 /* VoIP.xcdatamodel */;
                        name = myTitle.xcdatamodeld;
                        path = ../../../../VoIP/VoIP/VoIP.xcdatamodeld;
                        sourceTree = "<group>";
                        versionGroupType = wrapper.xcdatamodel;
                };
/* End XCVersionGroup section */

No idea how it came from and why it worked w/o problems in previous xcode versions.

cateof
  • 6,608
  • 25
  • 79
  • 153

2 Answers2

14

I had the same issue when I stashed a new Model and unfortunately the selected solution did not work for me. What worked for me was: find the model file in your project folder in Finder ("ModelNameHere.xcdatamodeld"); right-button click and select "Show Package Contents". You will see all versions of the Model - delete the one that was not supposed to exist.

tperei
  • 353
  • 2
  • 8
  • 1
    Same issue here. Created a second model but decided to start over. I then rolled back with git but somehow XCode kept the reference to the second data model even though is not actually shown anywhere on XCode itself (except for failing to build). The accepted answer didn't work for me, but when i did what @HeavenlyManBR suggests, i saw where XCode had kept the other model hidden from me. – Juan Carlos Ospina Gonzalez Dec 22 '16 at 09:23
  • This solution did work in 2020 using Xcode Version 11.3.1 (11C504). Thanks HeavenlyManBR and also @Jaun Carlos Ospina Gonzalez. The worst part is `git status` does not show this change. – Pankaj Kulkarni Mar 23 '20 at 10:32
12

Check Compile Sources under Build Phases for your Target setting described in the below image.


enter image description here


I saw all the resources carefully and found one resource without any path (an unknown resource, I don't know how it appeared there..). Remove it from there, clean the product and run.

The above was the only reason in my case..

Hope it helps you !!!

NSPratik
  • 4,714
  • 7
  • 51
  • 81
  • 1
    Just to add, either there may be resources without path OR resources with a wrong path. – Gaurav Srivastava Nov 05 '15 at 07:05
  • Another thing to add - resources without path does NOT necessarily mean it should be removed (all resources in the project root directory doesn't have their paths), but those ones with a gray icon and dotted outlines are those "unknown" resources. – technophyle Sep 12 '16 at 19:31
  • Saved my day! Thanks :) – limlim Feb 23 '17 at 11:02