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

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 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安装重建项目。

其他回答

您是否打开工作区(由CocoaPods生成)而不是xcodeproj?

在所有pod中只使用_active_arch =NO解决了我的问题。为了让它持久,我在Podfile中添加了一个post_install钩子:

post_install do |installer_representation|
  installer_representation.project.targets.each do |target|
      target.build_configurations.each do |config|
            config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
      end
  end
end

Pod安装完成。

你是否创建了“分销”或类似的配置来制作Ad-Hoc和App Store存档? 像许多其他人一样,我遵循了苹果的建议,将其命名为“发布”配置,并将其称为“分发”,并为其设置了不同的签名规则。好吧,也许这是他们在组织者中引入计划和“分发”选项之前的一个建议,不管怎样,我只是之前有过。

然后我对豆荚也有同样的问题。调试时一切正常,但存档失败,链接错误。在尝试了这个和那个之后,我把我原始项目的存档配置从“分发”改为“发布”,链接错误消失了。

然而,归档没有显示在组织者,虽然我可以在文件系统中找到它,但它的大小为0。

解决这一切的最后一步是改变“跳过安装”设置为“发布”配置为“NO”。注意,你只需要在你的主项目中这样做,而不是在Pods项目中。最好让pod项目保持原样,因为它是在每次运行“pod install”时生成的。

更新 刚刚得到CocoaPods开发人员的答复 它似乎对我不起作用,因为我已经正确设置了Pods配置。 但它可以帮助其他人。

我想念libPods。目标中的A,所以要做的第一件事是将它添加到链接的框架和库中。

接下来,Product -> Build for -> Profiling(或在添加libPods之前)。A,如果你完全错过了它)

最后在构建阶段检查你的Copy Pods资源脚本(如果它和你的第二个目标相同-有时它取决于Podfile和它的目标)。然后您就可以成功构建了。

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