Cocoapods仅为Debug指定podspec xcconfig值 [英] Cocoapods specify podspec xcconfig value for Debug only
问题描述
我正在使用cocoapods并希望使用特定于调试模式的xcconfig参数在pod的podspec中指定一个值。
I am using cocoapods and want to specify a value in the pod's podspec using the xcconfig parameter that would be specific to Debug mode.
当前使用:
s.xcconfig = { "GCC_PREPROCESSOR_DEFINITIONS" => "MY_DEFINE=1" }
将设置调试和释放模式的值。还尝试使用:
will set the value for both Debug and Release modes. Also tried using :
s.xcconfig = { "GCC_PREPROCESSOR_DEFINITIONS[config=Debug]" => "MY_DEFINE=1" }
但是,如果将其设置在pod的预处理器宏中,它就不会t似乎在执行代码期间注册,与不使用[config = Debug]标记时不同。有没有办法将它限制为仅调试模式?
but, altho this sets it in the pod's preprocessor macros, it doesn't seem to register during execution of the code, unlike when not using the [config=Debug] tag. Is there a way to limit it to Debug mode only?
推荐答案
您应该创建两个单独的podspec,每个podspec具有不同的xcconfig,然后使用要链接到每个配置的配置:
You should create two separate podspec's each with different xcconfig and then use configurations to link to each of them:
pod 'my-podspec-debug', :configurations => ['Debug']
pod 'my-podspec-release', :configurations => ['Release']
请参阅此旧答案: https://stackoverflow.com/a/26074997/1509221
这篇关于Cocoapods仅为Debug指定podspec xcconfig值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!