我的项目使用CocoaPods和自定义xcconfig文件.到目前为止,这并没有造成任何问题:我只是#include在自定义配置结束时不得不使用CocoaPods生成的配置.
但是,我遇到了需要根据情况有条件地指定OTHER_LDFLAGS的问题xcconfig,但我无法弄清楚如何做到这一点.
首先,我尝试简单地记录OTHER_LDFLAGS这样,但实际上没有记录标志:
post_install do |installer_representation|
installer_representation.project.targets.each do |target|
target.build_configurations.each do |config|
name = target.name
puts "Target Found: #{name}"
flags = config.build_settings['OTHER_LDFLAGS']
puts "OTHER_LDFLAGS Found: #{flags}"
end
end
end
Run Code Online (Sandbox Code Playgroud)
输出如下所示:
Target Found: Pods-ProjectName-DependencyName1
OTHER_LDFLAGS Found: # nothing here...?
Target Found: Pods-ProjectName-DependencyName2
OTHER_LDFLAGS Found: # again nothing...
# etc...
Target Found: Pods-ProjectName # Cool, this is the main target pod
OTHER_LDFLAGS Found: # ...
Run Code Online (Sandbox Code Playgroud)
如何OTHER_LDFLAGS通过CocoaPods安装后挂钩实际修改?