The problem is that CocoaPods is based on xcconfig files and sets the actual variables. But these values ββcannot be used in any way when the full configuration is in xcconfig files, for example:
#include "../Pods/Target Support Files/Pods-Demo/Pods-Demo.debug.xcconfig" GCC_PREPROCESSOR_DEFINITIONS = ...
In this case, GCC_PREPROCESSOR_DEFINITIONS overwrites the previous value.
Here's how to solve it:
Update the GCC_PREPROCESSOR_DEFINITIONS to override the GCC_PREPROCESSOR_DEFINITIONS value with the PODS_ prefix in post_install:
post_install do |installer| work_dir = Dir.pwd Dir.glob("Pods/Target Support Files/Pods-Demo/*.xcconfig") do |xc_config_filename| full_path_name = "#{work_dir}/#{xc_config_filename}" xc_config = File.read(full_path_name) new_xc_config = new_xc_config.sub(/GCC_PREPROCESSOR_DEFINITIONS/, 'PODS_GCC_PREPROCESSOR_DEFINITIONS') File.open(full_path_name, 'w') { |file| file << new_xc_config } end end
Define the xcconfig file as follows:
#include "../Pods/Target Support Files/Pods-Demo/Pods-Demo.debug.xcconfig" GCC_PREPROCESSOR_DEFINITIONS = $(PODS_GCC_PREPROCESSOR_DEFINITIONS) ...
In this case, GCC_PREPROCESSOR_DEFINITIONS should contain PODS_GCC_PREPROCESSOR_DEFINITIONS and custom values.
sgl0v source share