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

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'

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


当前回答

在我的案例中,pod安装在创建分发和发布方案后解决了这个问题。

其他回答

如果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

简化一下@i4niac的回答:

另一个常见的原因是方案的构建配置不匹配。 在我们的案例中,我们的“AppName-AppStore”方案将“发布”作为存档构建配置,而不是“AppStore”。

如果你在cocoapods v25 / Xcode 5上遇到问题

Pods Xcode项目现在在Debug配置中将ONLY_ACTIVE_ARCH构建设置设置为YES。您必须在项目/目标上设置相同的参数,否则构建将失败。

https://github.com/CocoaPods/CocoaPods/wiki/FAQ#running-into-build-failures-after-migrating-to-xcode-5-and-cocoapods-0250

更新 确保你有最新的宝石/ cocoapods

Gem更新系统 Gem更新cocoapods

您将希望使用 Pod安装重建项目。

如果你使用的是iOS7和Xcode 5,请:

选择你的Pods项目。 转到目标Pods,在构建设置中,选择架构->标准架构(armv7, armv7s)。 对Pods项目的每个Target执行同样的操作。

我遇到了一个问题,我创建了自己的.xcworkspace,它保持豆荚形式创建它自己的(在哪里它附加它的库)。

解决方案

我移动了我创建的.xcworkspace,再次运行pod install,然后手动将我的.xcworkspace与通过打开两个工作空间并将文件从一个工作空间拖到另一个工作空间而创建的pod合并。