我存档一个项目时出错了。这就是我的环境。

Mac OS Lion Xcode 4.3.1 iOS SDK 5.1

项目部署目标为:

IPHONEOS_DEPLOYMENT_TARGET 3.2

错误显示:

ld: library not found for -lPods
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我猜Pods就是我用来管理XCode项目依赖的CocoaPods。 https://github.com/CocoaPods/CocoaPods

这是我的Podfile

platform :ios  
dependency 'libPusher', '1.1'

我不确定这个错误是什么意思?


当前回答

只有将“库搜索路径”(在“MyProject”的构建设置中)添加到“Pods/ Build / debug - iphonessimulator”中才对我有效(当使用模拟器时)。

从这里开始: https://github.com/CocoaPods/CocoaPods/issues/121#issuecomment-5452473

其他回答

在我的例子中,这个链接中的第4个FAQ帮助了我: https://github.com/CocoaPods/CocoaPods/wiki/Creating-a-project-that-uses-CocoaPods

如果问题仍然存在,您可以尝试其他一些方法。

我在Podfile中通过使用将app和测试目标分开

target :App do
    …
end

target :AppTests do
    …
end

这导致了两个新产品libPods-App。a和libPods-AppTests。a,他们做了之前的产品libPods。一个过时的。我必须从两个目标的构建阶段配置的Link Binary With Libraries部分中删除此产品。

如果Xcode在链接时报错,例如Library not found for -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”.

http://docs.cocoapods.org/guides/getting_started.html

我有同样的问题,当我编辑Podfile添加目标,我是使用没有目标之前。

子文件

target 'xxxx' do

pod 'xyz'
pod 'abc'    

end

在四处闲逛后,我发现在目标属性>>常规选项卡>>链接框架和库部分,有新的libPods-xxxx。a和旧的libPods.a

我只是删除了libPods。A,一切都很好。

我将项目从“伙伴”重命名为“NBSelector”。

在重命名项目后,我有“libPods-Partners未找到库”错误。Xcode试图链接到旧的合作伙伴。一个文件。只要删除它,如果你有podInstalled重命名后。