ios - 方案的 Cocoapods 优化级别

标签 ios xcode cocoapods

查看 Cocoapods Pods.xcodeproj 的项目文件,看起来每个库的每个方案(Debug 方案除外)的优化级别都是 最快,最小

有没有一种快速简便的方法来更改 Podfile 或 Cocoapods 的一些其他配置,以便在我使用 时针对特定方案优化级别为 None pod 安装?

enter image description here

最佳答案

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

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 Pod,您还需要设置 SWIFT_OPTIMIZATION_LEVEL

关于ios - 方案的 Cocoapods 优化级别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21716003/

相关文章:

javascript - 在移动设备上使用 skrollr 时网站无法完全滚动

ios - mapView.annotations.count 在 swift 中不为 0

iphone - 不保存数据的外部类对象

ios - 如何在 sprite Kit 场景中更改重力源

iphone - 如何在 ios 中使用 URL 和 NSString 在 UIImageView 上显示图像?

ios - 词法或预处理器问题。 - "File not found."

iOS 架构 x86_64 Xcode 的 undefined symbol

ios - 迭代数组时,TableViewcells 不会出现在 tableView 中。 iOS 版

IOS:启动图像多语言

ios - Google Maps 1.10.1 iOS with cocoapods 给出重复符号错误