Xcode 12部署警告“ IPHONEOS_DEPLOYMENT_TARGET”

时间:2020-11-06 01:56:53

标签: react-native cocoapods

我安装了react-native-maps并开始收到以下警告:

警告:iOS模拟器部署目标 “ IPHONEOS_DEPLOYMENT_TARGET”设置为8.0,但支持的范围 部署目标版本是9.0至14.1.99。 (在目标“ Flipper”中 来自项目“ Pods”)警告:iOS模拟器部署目标 “ IPHONEOS_DEPLOYMENT_TARGET”设置为7.0,但支持的范围 部署目标版本是9.0至14.1.99。 (在目标 项目“ Pods”中的“ Google-Maps-iOS-Utils”)警告:iOS 模拟器部署目标“ IPHONEOS_DEPLOYMENT_TARGET”设置为 8.0,但支持的部署目标版本的范围是9.0至14.1.99。 (在项目“ Pods”中的目标“ react-native-google-maps”中)

我看到了一些在线建议,如下所示:

post_install do |installer|
     installer.pods_project.targets.each do |target|
         target.build_configurations.each do |config|
             config.build_settings['DEBUG_INFORMATION_FORMAT'] = 'dwarf'
             config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
             config.build_settings['ONLY_ACTIVE_ARCH'] = 'YES'
         end
     end
  end

但是,我的podfile如下所示(这是我安装react-native时的样子)

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '10.0'

target 'allocentric' do
  config = use_native_modules!

  use_react_native!(:path => config["reactNativePath"])
  # React Native Maps dependencies
  rn_maps_path = '../node_modules/react-native-maps'
  pod 'react-native-google-maps', :path => rn_maps_path
  pod 'GoogleMaps'
  pod 'Google-Maps-iOS-Utils'
  pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
  target 'allocentricTests' do
    inherit! :complete
    # Pods for testing
  end

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable these next few lines.
  use_flipper!
  post_install do |installer|
    flipper_post_install(installer)
  end
end

target 'allocentric-tvOS' do
  # Pods for allocentric-tvOS

  target 'allocentric-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end
end

在“ post_install”已经存在之前,我似乎无法运行在线发布的解决方案,我已经尝试删除第一个post_install或将上述解决方案放入该post_install中,但均无效。

2 个答案:

答案 0 :(得分:0)

尝试将其添加到pod文件中

post_install do |pi|
    pi.pods_project.targets.each do |t|
      t.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
      end
    end
end

参考:Range-of-supported

答案 1 :(得分:0)

注释以下行

add_flipper_pods!
post_install do |installer|
  flipper_post_install(installer)
end

同时在 Pod 文件末尾添加以下几行

post_install do |installer|
  installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
         if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 9.0
           config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
         end
      end
  end
end