Cocoapods specify podspec xcconfig value for Debug only

萝らか妹 提交于 2019-12-04 07:49:46
brunobowden

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']

See this old answer: https://stackoverflow.com/a/26074997/1509221

You can achieve what you need by adding this in your podspec file:

 s.xcconfig = { "GCC_PREPROCESSOR_DEFINITIONS" => "$(GCC_PREPROCESSOR_DEFINITIONS_$(CONFIGURATION))",  
                "GCC_PREPROCESSOR_DEFINITIONS_Debug" => "MY_DEFINE=1" }

You can use Variable Substitution to assign a value to GCC_PREPROCESSOR_DEFINITIONS based on an other variable that its name your create based on the on the build configuration name(i.e. GCC_PREPROCESSOR_DEFINITIONS_$(CONFIGURATION)).

You can read more here https://pewpewthespells.com/blog/xcconfig_guide.html#VariableSubstitution

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!