方案的Cocoapods优化级别 [英] Cocoapods optimization level for schemes

查看:174
本文介绍了方案的Cocoapods优化级别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在查看Cocoapods Pods.xcodeproj 的项目文件时,它看起来像每个库的每个方案( Debug 方案)的优化级别为最快,最小

Looking at the project file for Cocoapods Pods.xcodeproj it looks like every single scheme for every library (except for Debug scheme) has an optimization level of Fastest, Smallest.

是否可以快速便捷地进行更改 Podfile 或其他一些Cocoapods配置,以便当我使用<$ c时特定方案的优化级别为 None $ c> pod install

Is there a quick and easy way to change the Podfile or some other configuration of Cocoapods so that the optimization level is None for specific schemes when I use pod install?

推荐答案

我在Podfile中使用post_install钩子。像这样:

I use post_install hook in Podfile. Like this:

post_install do |installer|
    installer.pods_project.build_configurations.each do |config|
        if config.name.include?("Debug")
            config.build_settings['GCC_OPTIMIZATION_LEVEL'] = '0'
            config.build_settings['SWIFT_OPTIMIZATION_LEVEL'] = '-Onone'
        end
    end
end

编辑
GCC_OPTIMIZATION_LEVEL 被Swift Pod忽略。如果您使用的是Swift Pods,则还需要设置 SWIFT_OPTIMIZATION_LEVEL

EDIT GCC_OPTIMIZATION_LEVEL is ignored for Swift Pods. If you're using Swift Pods you also need to set SWIFT_OPTIMIZATION_LEVEL.

这篇关于方案的Cocoapods优化级别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆