Can't find Pods.modulemap - looking in wrong directory

纵饮孤独 提交于 2019-11-27 21:15:01

The solution that worked for me was:

First step:
(this step may no longer be needed in Xcode 9.x and newer)

  1. Open Xcode
  2. Click Window (Menu Bar)
  3. Click Projects
  4. Remove all projects (e.g. use backspace)
  5. Close Xcode

Second Step:

  1. Open a terminal app
  2. cd ~/Library/Developer/Xcode/DerivedData
  3. rm -rf Build/* see below if you have a customized build location
  4. rm -rf ModuleCache/*
  5. Close a terminal app

Third Step:

  1. Open Xcode
  2. Product > Clean
  3. Product > Run

Source: https://stackoverflow.com/a/30752152/756976

If you have defined a custom build location:

  1. Go with Finder or the Terminal to the location of the build files. The location for these files is defined in Xcode. To check where these files are:
    • Open Xcode
    • Go to Settings -> Locations -> Derived Data
  2. Go to that location and delete the Build folder

Edit: June 9, 2016

It is also possible that this resolves your problem:

By default the clean of Xcode, does not delete everything, by going to Product, pressing the ALT-key, the Clean-button will change to Clean Build Folder....

In my case I had made a few changes to my PodFile, got a similar error and just re-ran 'install':

% pod install

And I was back in business.

I solved my problem by removing the pods from the pod file, pod install, add them again, then pod install again.

looks like a pod was incorrectly installed.

A similar problem happened to me with core data when reseting changes that involved core new version from the source control (Git). it threw:

/Path/To/Model/Model.xcdatamodel: Failed to read data model Error Domain=NSCocoaErrorDomain Code=260 "The file “contents” couldn’t be opened because there is no such file." UserInfo={NSFilePath=/Path/To/Model/Model.xcdatamodel/contents, NSUnderlyingError=0x7fb632e558d0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}

I was unable to build the project because of that error I've tried the above solution but it didn't work.

What worked for me was:

  1. Open the RootModel.xcdatamodel (Left click on the model and Show in Finder).
  2. Manually erase the Model.xcdatamodel that triggets the issue.
  3. Clean project (cmd+shift+k) and Run.

Hope this helps someone.

The simplest way though is going to Xcode's Preferences

Preferences->Locations->Derived Data

Just deleting Derived Data folder does the trick. Just Clean and Build the project again after, should not throw any errors.

What worked for me was to go to the project directory, where the pod file is. and:

rm -f Podfile.lock
rm -rf Pods/

That actually removed all the culprits and I was able to build and run the project again.

( I also did the previously mentioned steps, removed build folder and module caches, but that didn't help)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!