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

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'

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


当前回答

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

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

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

其他回答

我发现选择“查找隐式依赖项”(在product / edit scheme下)将解决这个问题,而不必将pod添加为目标。

尝试打开xcworkspace文件而不是xcodeproj文件

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

子文件

target 'xxxx' do

pod 'xyz'
pod 'abc'    

end

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

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

删除CocoaPods缓存文件夹~/Library/Caches/CocoaPods和安装pod对我来说是有效的。

在所有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安装完成。