我正在构建一个框架,其中一个方法使用了预处理器标记。代码如下所示:
public func heyStuck(overflow: String) {
#if DEBUG
print(overflow)
#else
print("¯\\_(ツ)_//¯")
#endif
}
关键是我正在使用Cocoapods导入我的框架,所以为了为框架定义DEBUG标志,在我的App Podfile中必须像这样做:
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
有没有办法将此信息添加到podspec文件中,以便避免应用程序在其Podfile中定义此内容?