首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >支持的平台,base,只在pod更新后恢复活动体系结构设置。

支持的平台,base,只在pod更新后恢复活动体系结构设置。
EN

Stack Overflow用户
提问于 2013-12-09 06:06:47
回答 5查看 3.8K关注 0票数 5

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

这是podfile:

代码语言:javascript
运行
复制
platform :ios, '6.0'

pod "UI7Kit"
pod "AFNetworking", "~> 2.0"
pod "TMCache"
pod "SVProgressHUD"
pod "SVPullToRefresh"

然而,在使用CocoaPods之后,为iPhone 5构建目标总是失败的,但是对于模拟器来说却成功了。

下面是错误日志:

代码语言:javascript
运行
复制
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故障排除中提到的解决方案,包括在列表的顶部添加Pods静态库,但仍然失败。

后来我们发现,在"Pods Project Settings“> "Build Settings”>“Architecture”中,"Base SDK“被设置为"No SDK (最新OS X)","Build Active Architecture Only”> "Debug“设置为"Yes”,"Supported“设置为"OS X”。在将它们分别更改为“iOS (iOS 7.0)”、"No“和"iOS”之后,为iPhone 5构建的程序和模拟器都工作得很好。

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

我的问题是:

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

任何帮助都将不胜感激。

EN

回答 5

Stack Overflow用户

发布于 2014-05-15 02:58:48

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

代码语言:javascript
运行
复制
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

这将使所有的吊舱为所有拱门建造。

票数 5
EN

Stack Overflow用户

发布于 2016-05-15 22:32:17

我以前经常按照那个程序..。现在有了cocoapods和更多的时间,我选择了:

代码语言:javascript
运行
复制
# 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
票数 3
EN

Stack Overflow用户

发布于 2015-04-09 22:26:34

我发现自己也遇到了这种情况,使用Cocoapods 0.36.3和Xcode 6.2。我非常怀疑这是最好的解决方案,但是我在Podfile的底部编写了一个钩子,它重置了Pods项目中的"BaseSDK“、"Platform”和"Build Only“设置。我还为每个目标设置了“仅构建Active Architecture”到"NO“,以便进行良好的度量(如上面的文章所述)。

代码语言:javascript
运行
复制
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
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20464183

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档