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

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'

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


当前回答

CocoaPods在GitHub上的wiki在他们的常见问题解答中有正确的答案:

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 <Project Dir>/Pods/<Name of spec you are trying to include>. If it is empty (it should not be), verify that the ~/.cocoapods/master/<spec>/<spec>.podspec has the correct github 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".

其他回答

我把这里的每个答案都看了一遍,但对我来说太简单了……转到Target -> Build Phases,然后删除libPods-YourProject。A,然后用“+”再加一次。别担心图书馆是红色的,没事的。

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

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

请确保打开的是.xcworkspace,而不是.xcodeproj

我有一个旧的libPod。指定的文件(可能是我更改目标造成的)。

项目设置->构建阶段->链接二进制库

通常,cocoapods只包含一个库,比如libPods-target。或libPods.a。我通过移除副本解决了这个问题。

我今天也遇到了类似的问题。

我建立了一个新项目 我安装了可可荚 我创建了一个新的配置预览以及现有的调试和发布 现在,当在这个新的预览配置上编译时,编译器将无法链接到Pods并给我这个消息: ld:没有为-lPods找到库

解决方案:

我要做的就是逃跑

 pod install

从而为新的Preview配置配置cocoapods。它更新了我的项目、工作区和Pod的项目文件,问题就消失了