Ios Cocoapod:使用安装后挂钩重新定义预处理宏

Ios Cocoapod:使用安装后挂钩重新定义预处理宏,ios,xcode,cocoapods,Ios,Xcode,Cocoapods,我想更新我的pod,让用户激活/取消激活功能 为此,我在我的podspec中添加了一个预处理器宏: s.xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => 'FEATURE=1' } 现在,对于用户来说,正确的做法(据我所知)应该是在podfile中使用安装后挂钩来更改功能的定义 post_install do |installer_representation| installer_representation.projec

我想更新我的pod,让用户激活/取消激活功能

为此,我在我的
podspec
中添加了一个预处理器宏:

s.xcconfig         = { 'GCC_PREPROCESSOR_DEFINITIONS' => 'FEATURE=1' }
现在,对于用户来说,正确的做法(据我所知)应该是在
podfile
中使用安装后挂钩来更改
功能的定义

post_install do |installer_representation|
  installer_representation.project.targets.each do |target|
    if target.name == "Pods-MyPod"
      target.build_configurations.each do |config|
        config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', 'FEATURE=0']
      end
    end
  end
end
但它什么也没做<代码>功能
值仍为1

我做错什么了吗

编辑:
我确实看了一下,但是没有用。

最后,我找到了一个可用的版本

post_install do |installer_representation|
  installer_representation.pods_project.targets.each do |target|
    if target.name == "Pods-MyPod"
      target.build_configurations.each do |config|
      config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = ['COCOAPODS=1', 'FEATURE=0']
      end
    end
  end
end

为什么被否决了。。。请随意在评论中解释自己,我将尝试更新我的问题。