Xcode 6.1 和 Cocoapods 集成/依赖错误 - 找不到 -lPods-{Pod Name} 的库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26457099/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Xcode 6.1 & Cocoapods Integration/Dependency Error - library not found for -lPods-{Pod Name}
提问by Nick
I just upgraded to OS 10.10 Yosemite and Xcode 6 and am having trouble getting my iOS app with CocoaPods dependencies to build.
我刚刚升级到 OS 10.10 Yosemite 和 Xcode 6,并且无法使用 CocoaPods 依赖项构建我的 iOS 应用程序。
After doing a clean and build I get an Apple Mac-O Linker Error
as shown below
进行清理和构建后,我得到Apple Mac-O Linker Error
如下所示的
Ld /Users/nick/Library/Developer/Xcode/DerivedData/ToWatchList-cesjouowyxujojcvvxsvupagyozc/Build/Products/Release-iphonesimulator/ToWatchList.app/ToWatchList normal i386
cd "/Users/nick/Dropbox/ToWatchList/ToWatchList App"
export IPHONEOS_DEPLOYMENT_TARGET=8.0
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk -L/Users/nick/Library/Developer/Xcode/DerivedData/ToWatchList-cesjouowyxujojcvvxsvupagyozc/Build/Products/Release-iphonesimulator -F/Users/nick/Library/Developer/Xcode/DerivedData/ToWatchList-cesjouowyxujojcvvxsvupagyozc/Build/Products/Release-iphonesimulator -F/Users/nick/Dropbox/ToWatchList/ToWatchList\ App/Pods/CrashlyticsFramework -F/Users/nick/Dropbox/ToWatchList/ToWatchList\ App -filelist /Users/nick/Library/Developer/Xcode/DerivedData/ToWatchList-cesjouowyxujojcvvxsvupagyozc/Build/Intermediates/ToWatchList.build/Release-iphonesimulator/ToWatchList.build/Objects-normal/i386/ToWatchList.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -ObjC -lPods-AFNetworking -lPods-AuxRepo -lPods-CrashlyticsFramework -lPods-Reachability -lPods-SSKeychain -lPods-SVProgressHUD -lPods-Tapstream -framework CoreGraphics -framework Crashlytics -framework Foundation -framework MobileCoreServices -framework QuartzCore -framework Security -framework SystemConfiguration -framework UIKit -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=8.0 -lz -lPods -Xlinker -dependency_info -Xlinker /Users/nick/Library/Developer/Xcode/DerivedData/ToWatchList-cesjouowyxujojcvvxsvupagyozc/Build/Intermediates/ToWatchList.build/Release-iphonesimulator/ToWatchList.build/Objects-normal/i386/ToWatchList_dependency_info.dat -o /Users/nick/Library/Developer/Xcode/DerivedData/ToWatchList-cesjouowyxujojcvvxsvupagyozc/Build/Products/Release-iphonesimulator/ToWatchList.app/ToWatchList
ld: library not found for -lPods-AFNetworking
clang: error: linker command failed with exit code 1 (use -v to see invocation)
It seems to have something with the OTHER_LDFLAGS
(Other Linker Flags) on my project because if I reorder my pods by going to my application target -> Build Settings -> Other Linker Flags and reorder the items on that list, I can get other pods to generate Linker Errors in the same way (so at least it's not a problem with AFNetworking). Cocoapods and Xcode are not generating any other errors or warnings.
它似乎与OTHER_LDFLAGS
我的项目中的(其他链接器标志)有关,因为如果我通过转到我的应用程序目标 -> 构建设置 -> 其他链接器标志并重新排序该列表中的项目来重新排序我的豆荚,我可以让其他豆荚以相同的方式生成链接器错误(所以至少它不是 AFNetworking 的问题)。Cocoapods 和 Xcode 不会产生任何其他错误或警告。
So far I've tried:
到目前为止,我已经尝试过:
Updating to the newest version of Cocoapods with:
sudo gem update cocoapods
Commenting out all the pods in my podfile, running
pod update
to clear them all out and then uncommenting them and runpod update
to re-download and install all the dependancies.Deleting my pod folder and lock file then running
pod install
to reinstall pods from scratch
更新到最新版本的 Cocoapods:
sudo gem update cocoapods
注释掉我的 podfile 中的所有 pod,运行
pod update
以将它们全部清除,然后取消注释并运行pod update
以重新下载并安装所有依赖项。删除我的 pod 文件夹和锁定文件,然后运行
pod install
以从头开始重新安装 pod
Unfortunately none of these steps fixed this error, so I'm guessing there is some Build Setting that I need to tweak in my project but I am unsure what to try next.
不幸的是,这些步骤都没有修复这个错误,所以我猜我需要在我的项目中调整一些构建设置,但我不确定接下来要尝试什么。
回答by dulgan
Double check that you are opening the .xcworkspace
file and not the .xcodeproj
file, that's a common mistake that can lead to this kind of problems.
仔细检查您打开的是.xcworkspace
文件而不是.xcodeproj
文件,这是可能导致此类问题的常见错误。
回答by Nick
To fix this I had to delete libPods.a
under Application Targets-> General-> Linked Frameworks and Libraries. It was highlighted in red (meaning unfound) but I didn't need to replace it; simply clearing it was enough.
为了解决这个问题,我必须libPods.a
在Application Targets-> General-> Linked Frameworks and Libraries下删除。它以红色突出显示(表示未找到),但我不需要替换它;只需清除它就足够了。
回答by Ethan Edgerton
For me, the problem was that my project's and Cocoapod's build configurations didn't match, which (I think) meant they were looking in different directories for the compiled libraries.
对我来说,问题是我的项目和 Cocoapod 的构建配置不匹配,这(我认为)意味着他们正在不同的目录中查找已编译的库。
回答by Will
I had the same issue.
我遇到过同样的问题。
My problem was the the 'Build Active Architectures' on my Target and my Pods target did not match up exactly.
我的问题是我的目标上的“构建活动架构”和我的 Pod 目标不完全匹配。
After making them identical the issue was resolved.
使它们相同后,问题就解决了。
回答by Bejibun
Go to "Project Target -> Build Settings -> Preprocessing -> Preprocessor Macros". Set "COCOAPODS=1" in all Debug, Integration, Release under "Preprocessor Macros"
Add the following in "Other Linker Flags" under "Project Target" $inherited -ObjC -lc++ -all_load
Had a same issue after upgrading Deployment target from 7.0 to 8.0 and enabling use_frameworks!
转到“项目目标 -> 构建设置 -> 预处理 -> 预处理器宏”。在“预处理器宏”下的所有调试、集成、发布中设置“COCOAPODS=1”
在“项目目标”下的“其他链接器标志”中添加以下内容 $inherited -ObjC -lc++ -all_load
将部署目标从 7.0 升级到 8.0 并启用 use_frameworks 后遇到了同样的问题!