我遇到一个名为DCIntrospect-ARC的Pod,该Pod仅在DEBUG模式下有效。它在运行前检查是否已定义DEBUG宏。但是,它没有在CocoaPods目标中定义,即使我在Xcode中以调试模式运行,它也由于无法定义DEBUG宏而无法运行。
我可以使用以下方法在podspec中定义DEBUG宏:
s.xcconfig = { "GCC_PREPROCESSOR_DEFINITIONS" => '$(inherited) DEBUG=1' }
但这为所有构建配置(不仅是DEBUG配置)定义了DEBUG。
您可以在Podfile中使用post_install挂钩。
该挂钩可让您在将生成的Xcode项目写入磁盘之前,对其进行最后的更改,或者执行其他可能要执行的任务。 http://guides.cocoapods.org/syntax/podfile.html#post_install
post_install do |installer_representation|
installer_representation.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if config.name != 'Release'
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', 'DEBUG=1']
end
end
end
end
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句