我正在尝试在iOS项目中使用Cocoapods和一些自定义配置。
我有3(开发,舞台,戳),他们每一个都有一些定制的GCC_PREPROCESSOR_DEFINITIONS。我见过周围的人向我们建议#include <path-to-pods.xcconfig>,但这似乎是老办法。
我已经看到Cocoapods 0.39正在根据我的配置自动生成它的配置文件,并将它们自动添加到我的目标中(这很好)。
这篇文章也证实了这一点,他正在讨论一种创建Podfile的“新方法”。问题是这些文件不包含我的配置。
我试图使用xcodeproj和link_with,但没有成功。有人知道处理Cocoapods +自定义xcconfig文件的正确方法吗?
发布于 2017-09-27 22:31:58
问题是CocoaPods基于xcconfig文件并设置实际变量。但当完整配置位于xcconfig文件中时,不能以任何方式使用这些值,如下所示:
#include "../Pods/Target Support Files/Pods-Demo/Pods-Demo.debug.xcconfig"
GCC_PREPROCESSOR_DEFINITIONS = ...在本例中,GCC_PREPROCESSOR_DEFINITIONS覆盖前一个值。
解决这个问题的方法如下:
GCC_PREPROCESSOR_DEFINITIONS上使用PODS_前缀重新定义post_install值:
new_xc_config.sub(/GCC_PREPROCESSOR_DEFINITIONS/,/ post_install /*..xcconfig) do |xc_config_filename| full_path_name = "#{ work_dir }/#{xc_config_filename}“xc_config = File.read(full_path_name) new_xc_config =File.read(Full_path_name)new_xc_config='PODS_GCC_PREPROCESSOR_DEFINITIONS') File.open(full_path_name,'w') {AC.26 file \file << new_xc_config } end在这种情况下,GCC_PREPROCESSOR_DEFINITIONS应该包含PODS_GCC_PREPROCESSOR_DEFINITIONS & you自定义值。
https://stackoverflow.com/questions/36337989
复制相似问题