如何在 Podfile 脚本中引用 Xcode 版本?

问题描述 投票:0回答:1

将我的 ios 升级到 Sonoma 14.0 后,我必须在 Podfile 中使用此语句

# thanks to Armanoide ref: https://github.com/facebook/react-native/issues/37748
  post_install do |installer|
      installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
          config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', '_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION']
        end
      end
  end

我的构建完成了。

但是,我的一些队友仍在使用 Xcode 14.3。为了适应不同的 Xcode 版本,我需要添加一个简单的 if 语句来确定 Podfile 脚本中当前的 Xcode 版本。

如何在此 Podfile 脚本中引用当前的 Xcode 版本?预先感谢。

ios react-native cocoapods
1个回答
0
投票

xcode_version =

xcodebuild -version
.split(" ”)[0]

© www.soinside.com 2019 - 2024. All rights reserved.