ios 找不到 -lPods 的库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9863836/
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
library not found for -lPods
提问by angelokh
I got an error when archiving a project. This is my environment.
归档项目时出现错误。这是我的环境。
- Mac OS Lion
- Xcode 4.3.1
- iOS SDK 5.1
- Mac OS 狮子
- Xcode 4.3.1
- iOS SDK 5.1
The project deployment target is:
项目部署目标是:
IPHONEOS_DEPLOYMENT_TARGET 3.2
The error shows:
错误显示:
ld: library not found for -lPods
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I guess Pods is CocoaPods that I used to manage XCode project dependencies. https://github.com/CocoaPods/CocoaPods
我猜 Pods 是我用来管理 XCode 项目依赖项的 CocoaPods。 https://github.com/CocoaPods/CocoaPods
This is my Podfile
这是我的 Podfile
platform :ios
dependency 'libPusher', '1.1'
I am not sure what the error means?
我不确定错误是什么意思?
回答by alloy
Are you opening the workspace (that was generated by CocoaPods) instead of the xcodeproj?
您是否打开工作区(由 CocoaPods 生成)而不是 xcodeproj?
回答by Andras Hatvani
I separated the app and the test targets in the Podfile by using
我通过使用将应用程序和 Podfile 中的测试目标分开
target :App do
…
end
target :AppTests do
…
end
This resulted in two new products libPods-App.aand libPods-AppTests.a, respectively and they made the previous product libPods.aobsolete. I had to remove this product from the Link Binary With Libraries Sectionof the Build Phasesconfiguration of both targets.
这导致分别产生了两个新产品libPods-App.a和libPods-AppTests.a,并且它们使之前的产品libPods.a过时了。我不得不从两个目标的Build Phases配置的Link Binary With Libraries 部分删除这个产品。
回答by Besi
I ran into a similar problem today.
我今天遇到了类似的问题。
- I setup a new project
- I installed cocoa pods
- I created a new configuration
Preview
along with the existingDebug
andRelease
Now when compiling on this new
Preview
configuration, the compiler would not be able to link with Pods and giving me this message:ld: library not found for -lPods
- 我设置了一个新项目
- 我安装了可可豆荚
- 我创建了一个新配置
Preview
以及现有Debug
和Release
现在在这个新
Preview
配置上编译时,编译器将无法与 Pod 链接并给我以下消息:ld: library not found for -lPods
The solution:
解决方案:
What I had to do was to run
我必须做的就是跑
pod install
again and thus configuring cocoapods for the new Preview
configuration. It updated my project, the workspace and the Pod's project file and the problem disappeared
再次为新Preview
配置配置 cocoapods 。它更新了我的项目、工作区和 Pod 的项目文件,问题消失了
回答by Michal Gumny
Be sure that you open .xcworkspace
, not .xcodeproj
确保您打开.xcworkspace
,而不是.xcodeproj
回答by Hemang
Not a solution worked for me, this is really unbearable, there's a file libpods.a
(which was red coloured) I removed it and everything working fine! Cheers to me ;)
不是对我有用的解决方案,这真的令人无法忍受,有一个文件libpods.a
(红色)我删除了它,一切正常!为我干杯;)
回答by Ayush Goel
I had divided my pod listings in the Podfile
for different targets like:
我分了我荚上市的Podfile
像不同的目标:
target :ABC do
pod 'KissXML', '~> 5.0'
pod 'libPhoneNumber-iOS', '~> 0.7.2'
end
target :ABCTests do
pod 'OCMock', '~> 2.2.1', :inhibit_warnings => true
end
And ran a pod install
并跑了一个 pod install
This created a new library libPods-ABC.a
to which my binary had to link to. But the bug was that it didn't delete the previous library i.e. libPods.a
.
这创建了一个新库libPods-ABC.a
,我的二进制文件必须链接到该库。但错误在于它没有删除以前的库,即libPods.a
.
Solution : Remove the library libPods.a
from Build Phases
of Link Binary With Libraries
.
解决方案:libPods.a
从Build Phases
of 中删除库Link Binary With Libraries
。
回答by Sebastian Hojas
I had an old libPod.a file specified (probably caused by me changing targets).
我指定了一个旧的 libPod.a 文件(可能是因为我改变了目标)。
Project Settings-> Build Phases-> Link Binary with Libraries
项目设置->构建阶段-> 将二进制文件与库链接
Usually, cocoapods would only include one library, such as libPods-target.a
or libPods.a
. I solved it by removing the duplicate.
通常,cocoapods 只会包含一个库,例如libPods-target.a
或libPods.a
。我通过删除重复来解决它。
回答by johndpope
if you are running into problems with this on cocoapods v25 / Xcode 5
如果您在 cocoapods v25 / Xcode 5 上遇到此问题
The Pods Xcode project now sets the ONLY_ACTIVE_ARCH build setting to YES in the Debug configuration. You will have to set the same on your project/target, otherwise the build will fail.
Pods Xcode 项目现在在 Debug 配置中将 ONLY_ACTIVE_ARCH 构建设置设置为 YES。您必须在项目/目标上进行相同设置,否则构建将失败。
UPDATE Make sure you have latest gems / cocoapods
更新确保你有最新的 gems/cocoapods
- gem update system
- gem update cocoapods
- 宝石更新系统
- gem 更新 cocoapods
You will want to rebuild project using Pod Install to rebuild project.
您将需要使用 Pod Install 重建项目来重建项目。
回答by HoratioCain
If Xcode complains when linking, e.g. Library not found for -lPods, it doesn't detect the implicit dependencies.
如果 Xcode 在链接时抱怨,例如未找到 -lPods 的库,则它不会检测隐式依赖项。
Go to Product > Edit Scheme Click on Build Add the Pods static library, and make sure it's at the top of the list Clean and build again If that doesn't work, verify that the source for the spec you are trying to include has been pulled from github. Do this by looking in /Pods/. If it is empty (it should not be), verify that the ~/.cocoapods/master//.podspec has the correct git hub url in it. If still doesn't work, check your XCode build locations settings. Go to Preferences -> Locations -> Derived Data -> Advanced and set build location to “Relative to Workspace”.
转到产品>修改方案点击构建添加荚静态库,并确保它在列表中清除并生成顶部再次如果不起作用,请验证您要包括规范的来源一直从 github 中提取。通过查看 /Pods/ 来做到这一点。如果它是空的(不应该是),请验证 ~/.cocoapods/master//.podspec 中是否包含正确的 git hub url。如果仍然不起作用,请检查您的 XCode 构建位置设置。转到首选项 -> 位置 -> 派生数据 -> 高级并将构建位置设置为“相对于工作区”。
回答by Khaled Annajar
I had the same problem when I edited the Podfile adding the target which I was using without a target before.
当我编辑 Podfile 添加目标时,我遇到了同样的问题,而我之前在没有目标的情况下使用了该目标。
Podfile
播客文件
target 'xxxx' do
pod 'xyz'
pod 'abc'
end
After wondering around I found that under target properties >> General tab >> Linked Frameworks and Libraries section, There were the new libPods-xxxx.a and the old one libPods.a
想了想之后,我发现在目标属性 >> 常规选项卡 >> 链接框架和库部分下,有新的 libPods-xxxx.a 和旧的 libPods.a
I just removed libPods.a and everything worked fine.
我刚刚删除了 libPods.a,一切正常。