小编KID*_*dAe的帖子

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

我想更新我的 pod 以让用户激活/停用某个功能。

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

s.xcconfig         = { 'GCC_PREPROCESSOR_DEFINITIONS' => 'FEATURE=1' }
Run Code Online (Sandbox Code Playgroud)

现在,对于用户来说,正确的做法(我所理解的)应该是在 中使用安装后挂钩podfile来更改的定义FEATURE

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
Run Code Online (Sandbox Code Playgroud)

但它根本没有做任何事情......FEATURE价值仍然是1

难道我做错了什么 ?

编辑:我确实看过这个答案,但没有帮助。

xcode ios cocoapods

3
推荐指数
1
解决办法
929
查看次数

标签 统计

cocoapods ×1

ios ×1

xcode ×1