我在Xcode 10.1中得到了下面的警告信息。

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

我的模拟器操作系统是12.1 Xcode 10.1

我更新了pod文件。

我的部署目标是9.0

在我的目标中


当前回答

我们可以将项目部署目标应用于所有pods目标。 通过在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

结果记录:

其他回答

问题是在你的pod文件部署目标iOS版本中,而不是在你的项目部署目标iOS版本中,所以你需要改变你的pod的部署iOS版本到8.0以上的任何版本,这样就可以打开你的项目工作区并这样做:

1-点击pods。

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

3-在“部署”部分将iOS部署目标版本更改为8.0以上的任何版本 (最好尝试相同的项目版本)。

4-对你的pod中的其他项目重复这个步骤,然后运行应用程序。

详情见照片

为迅速

如果你在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" />

这是M1 macbook上的一个已知问题。运行颤振升级应该就能解决问题了。

目前致力于 M1 Mackbook 12.0.0 颤振2.10.0 飞镖2.16.0

对于有此问题的cordova开发者

试着设置

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

在config . xml

这个方法在扑动的时候对我很有效。打开{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