Could not create bundle folder for versioned model

2019-02-09 15:30发布

I received project from other developer. Then i opened iOS project in Xcode and build it, i got error as below:

Volumes/Macintosh D/My workspace/HCProject/Model/HealthCareModel.xcdatamodeld:0: error: 
Could not create bundle folder for versioned model at
'/Users/TomMac/Library/Developer/Xcode/DerivedData/HCProject-bdxarurbgcdbaecxaoocaroetsjt/Build/Products/Debug-iphoneos/HCProject.app/HealthCareModel.momd'

Sorry if this is a basic question,please help me out. Thanks a lot.

标签: iphone ios ios6
9条回答
【Aperson】
2楼-- · 2019-02-09 15:38

I had this and I thought I'd got rid of it but it kept coming back every few builds. I now seem to have permanently got rid of it with the following steps:-

  1. Locate the model file in Finder and take a copy of it to another (safe) location.
  2. In Xcode, delete the file from the project (selecting move to trash).
  3. Build the project just to make sure the project file is saved.
  4. Close Xcode.
  5. Locate the derived data directory in Finder and delete everything. (I actually deleted the entire DerivedData directory just to be sure).
  6. Re-open XCode.
  7. Copy the model file back from your safe location to your project directory location.
  8. Drag it into the Xcode project navigator in order to put it back in the project.
  9. Build - it should now work...
查看更多
We Are One
3楼-- · 2019-02-09 15:44
  1. iOS simulator, Select "iOS Simulator"
  2. Select "Reset Content and Settings"
查看更多
地球回转人心会变
4楼-- · 2019-02-09 15:45

I had this same problem after a large Git merge. It turned out I had a duplicate .xcdatamodeld in my Compile Sources. I deleted one and haven't had the problem since.

In case you're not sure where to look, open your project in Xcode and click the project name to view it's properties. Go to the 'Build Phases' tab, then expand the 'Compile Sources' heading.

查看更多
干净又极端
5楼-- · 2019-02-09 15:49

I don't know what causes this but I have experienced this error before.

The simplest way to fix it for me was to delete everything in in the "/Users/TomMac/Library/Developer/Xcode/DerivedData" directory.

There will be multiple directories under here you can probably get away with just deleting the one for the particular project that failed, but I haven't tested this.

查看更多
Ridiculous、
6楼-- · 2019-02-09 15:49

I had same issue and got it resolved by deleting content of derived data.

Below is step for the same :

1. Press cmd + comma (,) shortcut key to open preference window of Xcode.
   Or Goto Xcode menu on top and select Preference 

Screenshot 1

2. Select Locations tab present in last 

3. You can see Derived Data under Locations section

4. Click on small arrow present next to path. This open directory where project’s derived data content is present.

Screenshot 2

5. Select your project and delete it. Also delete the module cache folder.
    Note : You can even delete all content of Derived Data folder. 

   The content of this folder is generated again when it run. It is like cache.

Screenshot 3

 6. Quit your project

 7. Open your project. 

 8. Clean your project (cmd+shift+k)

 9. Build your project. This should build your project with no issues.
查看更多
何必那么认真
7楼-- · 2019-02-09 15:54

I had the same problem this morning. After multiple cleans, Xcode restarts, and finally a system restart, I looked in the system log. I found this error message that corresponded to the time of the build error.

"Interface Builder Cocoa Touch Tool[89487]: BUG in libdispatch client: kevent[EVFILT_VNODE] add: "Bad file descriptor" - 0x9"

I changed permissions on Library/Developer/ folder and granted read/write privileges to "everyone", then restarted Xcode. The build was successful.

I don't know for certain that the build error was caused by a permissions problem but it's worth a try. (If you have a lot of projects in the Developer folder, the permissions change can take several minutes to complete.)

查看更多
登录 后发表回答