受支持的平台,基础SDK,仅在pod更新后恢复主动体系结构设置

我的团队最近开始雇用CocoaPods来pipe理我们的iOS应用程序项目中的依赖项。

这是podfile:

platform :ios, '6.0' pod "UI7Kit" pod "AFNetworking", "~> 2.0" pod "TMCache" pod "SVProgressHUD" pod "SVPullToRefresh" 

但是,使用CocoaPods后,build立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) 

我已经尝试了CocoaPods疑难解答中提到的解决scheme,包括在列表顶部添加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和模拟器build设都工作正常。

但是,每次我们进行Pod update ,三种设置都会恢复到以前的状态,这很烦人。

我的问题是:

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

任何帮助将不胜感激。

正如CocoaPods问题中提到的,您可以将其附加到您的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 

这将使所有的荚build立所有的拱。

我发现自己也遇到了这种情况,使用Cocoapods 0.36.3和Xcode 6.2。 我非常怀疑这是最好的解决scheme,但我写了一个钩子去在我的Podfile的底部,在Pods项目中重置“BaseSDK”,“Platform”和“Build Active Architecture Only”设置。 对于每个目标,我也把“只build立主动架构”设置为“否”,好的措施(如上文所述)。

 post_install do |installer_representation| projectSDK = nil puts"Updating all of the POD targets to not default to ONLY_ACTIVE_ARCH for debug" installer_representation.project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO' if projectSDK.nil? projectSDK = config.build_settings['SDKROOT'] end end end puts "Updating ONLY_ACTIVE_ARCH for the project, as well. While the project settings aren't supposed to matter, I've not found that to be the case." puts "Also setting the base SDK of the project to match that of the targets (doesn't matter which one); otherwise it defaults to No SDK (Latest OS X)" installer_representation.project.build_configurations.each do |config| config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO' config.build_settings['SDKROOT'] = projectSDK end end 

我曾经遵循这个程序…现在用椰子树和更多的时间进入我select的事情:

 # fixes required for xcode project post_install do |installer_representation| puts "" puts "Updating VALID_ARCHS, SUPPORTED_PLATFORMS, SDKROOT for the project..." installer_representation.pods_project.build_configurations.each do |config| # config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO' config.build_settings['VALID_ARCHS'] = 'arm64 armv7 armv7s' config.build_settings['SUPPORTED_PLATFORMS'] = 'iphonesimulator iphoneos' # setting the base SDK of the project to match that of the project, # otherwise it defaults to No SDK (Latest OS X)" config.build_settings['SDKROOT'] = 'iphoneos' # it sets 'Valid Architectures' to '$(ARCHS_STANDARD)' to all pods # config.build_settings['SDKROOT'] = projectSDK end puts "" puts "Updating all of the watch POD targets with specific..." installer_representation.pods_project.targets.each do |target| target.build_configurations.each do |config| if (config.build_settings['SDKROOT'] == 'watchos') puts "fixing SUPPORTED_PLATFORMS & VALID_ARCHS for #{target.name} #{config.name}" config.build_settings['SUPPORTED_PLATFORMS'] = 'watchsimulator watchos' config.build_settings['VALID_ARCHS'] = 'arm64 armv7 armv7s armv7k i386' end # to not default to ONLY_ACTIVE_ARCH for debug" # config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO' # config.build_settings['ENABLE_STRICT_OBJC_MSGSEND'] = "NO" end end puts "" end 

Pods 项目设置无关紧要,重要的是Pod静态库的目标设置。 但你不应该碰他们。

你能从你的项目/目标发布你的构build设置吗? 故障排除指南build议在构build失败的情况下进行一些构build设置 ,它们有帮助吗? 一定要启用显示所有的构build设置,并检查是否有一些设置覆盖CocoaPods生成的xcconfig文件中指定的设置。

另外检查您的项目是否基于项目“信息”选项卡中的xcconfig文件。 在这里输入图像说明

我希望这有助于。

对于任何人使用最新的cocoa豆荚

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

结束