支持的平台,基本SDK,构建仅在pod更新后还原的活动架构设置

Laz*_*usX 5 iphone objective-c ios cocoapods

我的团队最近开始使用CocoaPods来管理iOS应用程序项目中的依赖项.

这是podfile:

platform :ios, '6.0'

pod "UI7Kit"
pod "AFNetworking", "~> 2.0"
pod "TMCache"
pod "SVProgressHUD"
pod "SVPullToRefresh"
Run Code Online (Sandbox Code Playgroud)

但是,在使用CocoaPods之后,iPhone 5的构建目标总是失败,但成功的模拟器.

这是错误日志:

ld: warning: ignoring file [DerivedData directory]/libPods.a, file was built for archive which is not the architecture being linked (armv7): [DerivedData directory]/libPods.a
Undefined symbols for architecture armv7:
  "_OBJC_CLASS_$_SVProgressHUD", referenced from:
      objc-class-ref in ....o
  "_OBJC_CLASS_$_TMCache", referenced from:
      objc-class-ref in ....o
  "_OBJC_CLASS_$_UI7Kit", referenced from:
      objc-class-ref in ....o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)

我尝试过CocoaPods故障排除中提到的解决方案,包括Pods在列表顶部添加静态库,但它仍然失败.

后来我们发现在"Pods Project Settings">"Build Settings">"Architectures"中,"Base SDK"设置为"No SDK(Latest OS X)","Build Active Architecture Only">"Debug"设置为"是"和"支持的平台"设置为"OS X".将它们分别更改为"最新iOS(iOS 7.0)","否","iOS"后,为iPhone 5和模拟器构建都可以正常工作.

但是,每次我们这样做时Pod update,所有这三个设置都会恢复到以前的状态,这很烦人.

我的问题是:

  1. 这种情况是设计还是我的项目/工作区设置有问题?
  2. 如何防止这些设置恢复到错误的状态?

任何帮助将不胜感激.

sam*_*ize 5

正如CocoaPods issues 中提到的,您可以将其附加到您的 Podfile 中:

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
Run Code Online (Sandbox Code Playgroud)

这将使所有 pod 为所有 arch 构建。


flo*_*ger 0

Pods项目设置并不重要,重要的是 Pod 静态库的目标设置。但你不应该碰它们。

您可以发布项目/目标中的构建设置吗?故障排除指南建议了一些构建设置,以防构建失败,它们有帮助吗?请务必启用显示所有构建设置,并检查某些设置是否覆盖xcconfigCocoaPods 生成的文件中指定的设置。

另请检查您的项目是否基于xcconfig项目“信息”选项卡中的文件。在此输入图像描述

我希望这能有所帮助。