iOS-CocoaPods로 빌드 실패 헤더 파일을 찾을 수 없습니다
CocoaPods를 사용하는 iOS 프로젝트가 있습니다. 다른 개발자가 동일한 프로젝트에서 작업을 시작할 때까지 모든 것이 순조롭게 진행되었습니다. 그는 (내가 아는 한 코드에만) 약간의 변경을 가하고 repo에서 새로운 브랜치를 만들었습니다. 그의 지점을 체크 아웃하고 빌드하려고했지만 오류가 발생합니다. ASLogger / ASLogger.h 파일을 찾을 수 없습니다.
전체 프로젝트를 삭제하고 새로 복사하여 'pods install'을 사용하더라도. 빌드 실패는 여전히 존재합니다. 문제가 어디 있는지 알 수 있습니까? 더 많은 정보가 필요하면 물어보십시오.
최신 정보
구성 파일이 누락 된 대상에 Podfile
포함 해야합니다 link_with
. Cocoapods 는 기본적으로 첫 번째 대상 만 설정합니다 . 예 :
platform :osx, '10.7'
pod 'JSONKit', '~> 1.4'
link_with 'Pomo', 'Pomo Dev', 'Pomo Tests'
------ 최종 업데이트
참고 : 아래 단계는 프로젝트-> 정보-> 구성을 참조해야합니다.
비슷한 증상이 있었고 빌드하려는 pods.xcconfig
특정 파일에 파일이 포함되지 않은 것으로 나타났습니다 target
. 다른 제안 된 솔루션 중 일부는 나를 위해 일했지만이 문제는 근본적인 문제의 일부를 해결하는 것처럼 보였습니다.
간단한 해결책은 설정이없는 대상에 대한 구성 파일 설정을 변경하는 것입니다.
최신 정보
나는 원래의 대답 이후로 이것을 업데이트했으며, 그것은 downvote를 얻었으므로 이것이 도움이되기를 바랍니다. 그리고 만약 그렇다면, 그것은 내 투표를 되찾아주기를 바랍니다.
헤더를 가져 오지 않는 경우에 충돌이있을 수 있습니다 HEADER_SEARCH_PATHS
. $(inherited)
빌드 설정에서 헤더 검색 경로를 추가 하고 CocoaPods에서 .xcconfig 파일에 포함 된 검색 경로를 가져 오도록하십시오.
이렇게하면 충돌에 도움이되고 소스를 올바르게 가져올 수 있습니다.
1. 확인
빌드 설정-> 검색 경로-> 사용자 헤더 검색 경로->
- "$ {PODS_ROOT} /"재귀
2. podfile
설정 한 경우 가져 오기 스타일 (키포인트)을 확인하십시오.
use_frameworks!
귀하 File-Bridging-Header.h
의 포맷터는 다음과 같아야합니다.
#import "MBProgressHUD.h"
그렇지 않으면 아래에 있어야합니다
#import <MBProgressHUD.h>
3. 그것이 작동해야합니다! 날 믿어
헤더 파일, 당신은 저의 죽음이 될 것입니다 ...
마지막으로 (따옴표 포함)을 추가하여 작동시킵니다.
"${PODS_ROOT}/BuildHeaders"
사용자 헤더 검색 경로 항목에 '재귀'를 확인하십시오.
I found ${PODS_HEADERS_SEARCH_PATHS}
is missing and it is not defined in my develop git branch, So I added "$(SRCROOT)/Pods/Headers/"
for Header Search Paths with recursive
That is ok for me
Both other answers didn't help here. I found 2 other problems that might fix it:
The Project->Info->Configurations in the Xcode project (your project) should be set to 'Pods' for Debug, Release (and whatelse you have). See "Headers not found – search paths not included"
Maybe you have to link the target with the link_with command. See "Unable to find headers in Static Library project"
EDIT You can check a symlink this way: create a textfile named 'check' without an extension. copy these lines into it:
file=/Users/youUserName/XcodeProjectName/Pods/BuildHeaders/SVProgressHUD/SVProgressHUD.h
if [[ ! -e $file && -L $file ]]; then
echo "$file symlink is broken!"
else
echo "symlink works"
fi
Then go to the terminal, change to the folder where your check file is located and type
bash check
Here's what worked for me:
Go to the Target > "Build Settings" tab and find the "User Header Search Paths" setting.
Set this to "$(BUILT_PRODUCTS_DIR)" and check the "Recursive" check box.
Now the built target will search the workspace’s shared build directory to locate the linkable header files.
====
UPDATE
I had a similar (although slightly different) problem recently. It turned out Xcode couldn't find the Pods because I had opened up the .xcodeproj
file rather than the .xcworkspace
file. Might help others in the future.
If none of the above worked for you and you are finding this error because you just switched to use_frameworks!
in your Podfile, read on:
I tried all the solutions above and a lot more before learning that it isn't about search header paths at all in my particular case; it's that when you switch to use_frameworks!
in your Podfile you no longer need to include frameworks in your bridging header, and in fact Xcode will throw the very unhelpful "unable to find header" error.
What you need to do is remove all imports from your bridging header file, and instead use the Swift import Module
in your individual Swift files as needed, just like you would for Swift frameworks.
AND if you are using any of the framework headers in your Obj-C classes (in my case we have a convenience class that used the FBSDK) you need to change it from a local to global import (this means change #import "Module.h"
to #import <Module/Module.h>
, which should autocomplete for you when you begin to type the framework name. In my case it was <AFNetworking/AFHTTPRequestOperationManager.h>
).
Edit: I've since learned that doing an @import Module
uses the umbrella file which is even safer.
Did you try importing Cocoapods style?
#import <ASLogger.h>
The info on the site is not really clear, I submitted a pull request:
https://github.com/CocoaPods/cocoapods.org/pull/34
Update: They pulled my request :)
The wiki gives an advice on how to solve this problem:
If Xcode can’t find the headers of the dependencies:
Check if the pod header files are correctly symlinked in Pods/Headers and you are not overriding the HEADER_SEARCH_PATHS (see #1). If Xcode still can’t find them, as a last resort you can prepend your imports, e.g. #import "Pods/SSZipArchive.h".
I was the only developer in the team experiencing this same issue, it worked perfectly for everybody so I realized it had to be my environment. I tried a git clone
of the same project in another directory and it compiled perfectly, then I realized it had to be Xcode caching stuff for my project path somewhere, that "somewhere" is the DerivedData folder, just remove it and do a clean build of your project, it worked for me.
You can get the path and even open the folder in finder by going to:
Xcode -> Preferences -> Locations -> **DerivedData
If you had the building errors after a "pod install" or a "pod update", it may be that one of your pods have been built with XCode 6.3 while you are still using a previous version.
In my case I had to update my OSX from mavericks to Yosemite to have Xcode 6.3 and solve the problem
I will update the below things in my Build settings and I did not get any errors. To check these are the things while updating your cocoapods.
Build Settings
Enable Bit code - YES(if you are using bitcode)
Macro preprocessor - $(inherited)
Other linker flag - objc, -lc++, $(inherited)
Build architecture only
Debug - Yes
Relese - No
Search Path
Framework search path - $(inherited) $(PROJECT_DIR)
Library search path - $(inherited)
Header search path - $(inherited)
for me the problem was in Other Linker flags value. For some reason I had no quotes in flags like -l"xml2"
-l"Pods-MBProgressHUD"
.
I had to download the zip from git hub and drag the missing files into the Finder at corresponding paths in Pod/...
I have got the same problem, but the above solutions can't work. I have fixed it by doing this:
- Remove the whole project
- Run git clone the project and run the bundle exec pod install
- cd the peoject and run remote add upstream your-remote-rep-add
- git fetch upstream
- git checkout master
- git merge upstream/master
And then it works.
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.
This was the answer for me, I updated cocoapods and I think that made the PODS_HEADERS_SEARCH_PATHS go away. My solution was similar to this but I used "$(PODS_ROOT)/Headers" – Andrew Aitken
Thank you so much for this answer. I had a hard time looking for ways to fix my problem. Thank you very much.
None of the answers helped me (I had my pods linked with all targets, build configurations setup properly, correclty set search paths "$(inherited)", etc...).
Problem disappeared by itself after I updated cocoapods to the newest, debug version using standard install / update command:
gem install cocoapods --pre
or:
sudo gem install cocoapods --pre
(if sudo was used during installation).
It must have been cocoapods bug.
What worked for me was selecting the Pods project, finding and selecting the target framework with the missing header in the Pod project's target directory and setting "Build Active Architecture Only" to "No" under "Architectures" in the target's build settings.
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!)
For me, what fixed it was the iOS deployment target for my Pods project was lower than my project itself. Once I made it the same as my project it was able to find the header file.
I've found that including the library as a pod install directly helps dynamic libraries. For example, for Firebase:
pod 'RNFirebase', :path => 'path/to/node_modules/react-native-firebase/ios'
Or for ASLogger:
pod 'ASLogger', :path => 'path/to/node_modules/aslogger/ios' // path to header files
Changing or hardcoding HEADER_SEARCH_PATHS
did not help me. If the error ever recurs, it's not necessary to rm -rf node_modules
nor delete the pod file etc, I found it useful to clear the cache.
For react-native, I run
rm -rf $TMPDIR/react-native-packager-cache-*
rm -rf $TMPDIR/metro-bundler-cache-*
rm -rf $TMPDIR/metro-*
rm -rf $TMPDIR/react-*
rm -rf $TMPDIR/haste-*
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache"
npm start -- --reset-cache
For Xcode I remove folders in ~/Library/Developer/Xcode/DerivedData
I solved this issues for Xcode 8.2.1 by drag and drop framework that i want to use.
One simple workaround is: 1. Delete Pods folder and Podfile.lock file. But don't delete Podfile 2. Run following command in your project root folder:
pod install
I have other worked solution here,
- Quit Xcode
- Open Xcode and clean project
- Build Pods project first
- Build Project
Have a try to comment this line for your target
# use_frameworks!
또는 xcode에 다른 추가 단위 테스트 대상을 참조 할 수 있습니다 -브리징 헤더를 가져 오지 못했습니다.
참고 URL : https://stackoverflow.com/questions/12002905/ios-build-fails-with-cocoapods-cannot-find-header-files
'IT' 카테고리의 다른 글
dyld : 라이브러리가로드되지 않음 : Mac에서 brew를 사용하여 노드를 설치 한 후 PHP를 실행하는 /usr/local/opt/icu4c/lib/libicui18n.62.dylib 오류 (0) | 2020.05.16 |
---|---|
psql : 치명적 : 사용자“dev”에 대한 피어 인증에 실패했습니다 (0) | 2020.05.16 |
SD 카드에 자동으로 디렉토리를 만드는 방법 (0) | 2020.05.16 |
수평 선형 레이아웃 안드로이드에서 위젯을 올바르게 정렬하는 방법은 무엇입니까? (0) | 2020.05.16 |
Uri에서 비트 맵을 얻는 방법? (0) | 2020.05.16 |