iOS - Build fails with CocoaPods cannot find heade

2019-01-01 12:07发布

I have an iOS project using CocoaPods. Everything was working smoothly until another developer started to work on the same project. He made some changes (only to code as far as I know) and made a new branch in the repo. I have checked out his branch and tried to build it, but I am getting an error: ASLogger/ASLogger.h file not found.

Even if I delete the whole project and make a fresh copy and use 'pods install .' the build failure is still there. Do you have any idea where the problem can be? If you need some more infos, just ask.

27条回答
人气声优
2楼-- · 2019-01-01 12:18

I had to download the zip from git hub and drag the missing files into the Finder at corresponding paths in Pod/...

查看更多
荒废的爱情
3楼-- · 2019-01-01 12:18

I have got the same problem, but the above solutions can't work. I have fixed it by doing this:

  1. Remove the whole project
  2. Run git clone the project and run the bundle exec pod install
  3. cd the peoject and run remote add upstream your-remote-rep-add
  4. git fetch upstream
  5. git checkout master
  6. git merge upstream/master

And then it works.

查看更多
不再属于我。
4楼-- · 2019-01-01 12:22

Header files, you'll be the death of me...

Finally got it to work by adding (including quotes)

"${PODS_ROOT}/BuildHeaders"

to the User Header Search Paths entry, and checking 'recursive'.

查看更多
谁念西风独自凉
5楼-- · 2019-01-01 12:22

Here's another reason: All the header paths seemed fine, but we still had an error in the precompiled (.pch) file trying to read a pod header

(i.e. #import <CocoaLumberjack/CocoaLumberjack.h>).

Looking at the raw build output, I finally noticed that the error was breaking our Watch OS Extension Target, not the main target we were building, because we were also importing the .pch precompiled header file into the Watch OS targets, and it was failing there. Make sure your accompanying Watch OS target settings don't try to import the .pch file (especially if you set that import from the master target setting, like I did!)

查看更多
听够珍惜
6楼-- · 2019-01-01 12:23

I was on the GM seed of Xcode 5.0 and I couldn't get any of these answers to work. I tried every single answer on SO on multiple different questions about header imports w/ cocoapods.

FINALLY I found a solution that worked for me: I upgraded to Xcode 5.0 via the Mac AppStore (installed on top of the GM seed) and now the header imports are working as expected.

I also still had a beta version of Xcode 5 on my system and I deleted that as well. Maybe it was a combination of the two things, but hopefully this helps someone else.

查看更多
公子世无双
7楼-- · 2019-01-01 12:23

I have other worked solution here,

  1. Quit Xcode
  2. Open Xcode and clean project
  3. Build Pods project first
  4. Build Project
查看更多
登录 后发表回答