查看 Cocoapods Pods.xcodeproj
的项目文件,看起来每个库的每个方案(Debug
方案除外)的优化级别都是 最快,最小
。
有没有一种快速简便的方法来更改 Podfile
或 Cocoapods 的一些其他配置,以便在我使用 时针对特定方案优化级别为
?None
pod 安装
最佳答案
我在 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/