iOS Simulator部署目标设置为7.0,但是此平台支持的部署目标版本范围是8.0至12.1。

时间:2019-02-15 07:05:57

标签: ios xcode cocoapods ios-simulator google-fabric

我在我的Xcode 10.1中收到以下警告消息。

  

iOS Simulator的部署目标设置为7.0,但是此平台支持的部署目标版本范围是8.0到12.1。

12.1中的模拟器OS Xcode 10.1

然后我更新了pod文件。

enter image description here

我的部署目标是9.0

enter image description here

在我的目标

enter image description here

19 个答案:

答案 0 :(得分:44)

遍历Tao-Nhan Nguyen的答案,计算每个pod的原始值,仅在大于8.0时才进行调整...将以下内容添加到Podfile中:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      if Gem::Version.new('8.0') > Gem::Version.new(config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'])
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '8.0'
      end
    end
  end
end

答案 1 :(得分:41)

您可以删除pod部署目标,而不是在pod post安装中指定部署目标,这会使部署目标从podfile平台继承。

您可能需要运行pod install才能生效。

platform :ios, '12.0'

  post_install do |installer|
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
      end
    end
  end

答案 2 :(得分:36)

如果您将CocoaPods与Xcode 12一起使用,则可能已经看到此错误:

The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.

之所以发生这种情况,是因为已放弃了对iOS 8的支持,但吊舱的最低部署目标是iOS 8。

在解决此问题之前,您可以将以下内容添加到Podfile中:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
    end
  end
end

这将从您项目中的所有Pod中删除部署目标,并允许他们继承在Podfile顶部指定的项目/工作区部署目标。

答案 3 :(得分:13)

您可以将podfile设置为自动将所有podfile的部署目标与当前项目部署目标相匹配,如下所示:

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

答案 4 :(得分:7)

如果您来自 react-native 并面临此错误,请执行此操作

  1. 打开 Podfile(您的项目 > ios>Podfile)
  2. 评论 podfile 中的鳍状肢功能如下
#use_flipper!
 #post_install do |installer|
   #flipper_post_install(installer)
 #end
  1. IOS 文件夹内的终端中输入此命令 pod install

是的,希望它对你有用

答案 5 :(得分:5)

如果有人在更新到最新的 React Native 时遇到问题,请尝试使用

更新您的 pod 文件
let divValue = $("#anchorWrap").text();
$("#anchorWrap").parent().get(0).innerHTML = divValue

答案 6 :(得分:3)

如果有人因本机问题而来到这里,只需删除/ build文件夹并键入react-native run ios

答案 7 :(得分:3)

我们可以将项目部署目标应用于所有Pod目标。 通过在您的Podfile的末尾添加以下代码块来解决:

post_install do |installer|
  fix_deployment_target(installer)
end

def fix_deployment_target(installer)
  return if !installer
  project = installer.pods_project
  project_deployment_target = project.build_configurations.first.build_settings['IPHONEOS_DEPLOYMENT_TARGET']

  puts "Make sure all pods deployment target is #{project_deployment_target.green}"
  project.targets.each do |target|
    puts "  #{target.name}".blue
    target.build_configurations.each do |config|
      old_target = config.build_settings['IPHONEOS_DEPLOYMENT_TARGET']
      new_target = project_deployment_target
      next if old_target == new_target
      puts "    #{config.name}: #{old_target.yellow} -> #{new_target.green}"
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = new_target
    end
  end
end

结果日志:

fix pods deployment target version warning

答案 8 :(得分:2)

此解决方案适用于 Flutter。打开 {your_project_root_folder}/ios/Podfile 并用这个替换 post_install 块

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |config|
      config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
    end
  end
end

答案 9 :(得分:2)

Flutter 中对我有用的简单修复:

  1. 删除PodfilePodfile.lock
  2. 运行应用程序:这将创建一个新的 Podfile。这可能会仍然失败并出现错误。
  3. 在新的 Podfile 中,取消注释并将第 2 行更改为 platform :ios, '12.0'(或您要定位的其他最小版本)
  4. 再次运行应用,现在没有错误

答案 10 :(得分:2)

对于 Swift

如果您在 Xcode 12 中使用 CocoaPods,那么您可能已经看到此错误:

The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.

发生这种情况是因为不再支持 iOS 8,但 pod 的最低部署目标是 iOS 8。

在修复此问题之前,您可以将以下内容添加到您的 Podfile 中:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
    end
  end
end

这将从您项目中的所有 Pod 中删除部署目标,并允许它们继承在 Podfile 顶部指定的项目/工作区部署目标。

对于 React Native

删除 ./project-root/ios/build 文件夹并输入 react-native run ios

科尔多瓦

<preference name="deployment-target" value="8.0" />

答案 11 :(得分:1)

看起来这是CocoaPods的一期(至今仍未修复):https://github.com/CocoaPods/CocoaPods/issues/7314

答案 12 :(得分:1)

问题出在Pod文件部署目标iOS版本中,而不是在项目部署目标iOS版本中,因此您需要将Pod的部署iOS版本以及更高的版本更改为8.0以上,以打开项目工作区并做到这一点:

1-单击窗格。

2-选择每个项目和目标,然后单击构建设置。

3-开发中部分将iOS版本更改为8.0以上 (最好尝试使用相同的项目版本)。

4-对pod中的其他所有项目重复此操作,然后运行应用程序。

查看照片以获取详细信息 enter image description here

答案 13 :(得分:0)

首先将部署更改为您选择的:例如“11.0” 并将此步骤添加到 pod 文件的最后一个

end
post_install do |installer|
 installer.pods_project.targets.each do |target|
  target.build_configurations.each do |config|
   config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
  end
 end
end

答案 14 :(得分:0)

尝试以下步骤:

  1. 删除您的Podfile.lock
  2. 删除您的Podfile
  3. 构建项目
  4. 从firebase添加初始化代码
  5. cd /ios
  6. pod install
  7. 运行项目

这对我有用。

答案 15 :(得分:0)

我解决了这个问题,将构建系统Legacy Build System更改为New Build System

在Xcode v10 +中,选择“文件”>“项目设置”

在以前的Xcode中,选择“文件”>“工作区设置”

enter image description here

将构建系统从Legacy Build System更改为New Build System->单击“完成”。

enter image description here

答案 16 :(得分:0)

platform :ios, '10.0'

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
    end
  end
end

答案 17 :(得分:-1)

针对有此问题的Cordova开发人员

尝试设置

<preference name="deployment-target" value="8.0" />

在confix.xml中

答案 18 :(得分:-2)

就我而言,我同时使用了npm installyarn install,这就是为什么我遇到此问题的原因 所以为了解决这个问题,我删除了package-lock.json和node_modules 然后我做到了

yarn install
cd ios
pod install

对我有用