繁体   English   中英

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

[英]The iOS Simulator deployment targets is set to 7.0, but the range of supported deployment target version for this platform is 8.0 to 12.1

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

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

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

我更新了我的 pod 文件。

在此处输入图像描述

我的部署目标是 9.0

在此处输入图像描述

在我的目标

在此处输入图像描述

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

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

问题出在您的 pod 文件部署目标 iOS 版本中,而不是您的项目部署目标 iOS 版本中,因此您需要将 pod 的部署 iOS 版本更改为高于 8.0 的任何版本,以便打开您的项目工作区并执行以下操作:

1-点击豆荚。

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

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

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

详情见照片在此处输入图像描述

您可以删除每个 pod 的 pod 部署目标,而不是在 pod post install 中指定部署目标,这会导致部署目标从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

迭代来自 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

如果有人从 react native 问题来到这里,只需删除 /build 文件夹并输入react-native run ios

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

结果日志:

修复 pods 部署目标版本警告

尝试以下步骤:

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

这对我有用。

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

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

在之前的 Xcode 中,选择 File > Workspace Settings

在此处输入图像描述

将 Build System 从New Build System更改为Legacy Build System System --> 单击 Done。

在此处输入图像描述

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

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

是的,就是希望它对你有用

如果有人在更新到最新的 react native 时遇到问题,请尝试更新您的 pod 文件

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

对于斯威夫特

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

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

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

该解决方案适用于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

您需要做的就是取消注释以下行

# platform :ios, '8.0'

或者

# platform :ios, '9.0'

ETC...

然后在终端中打开 iOS 文件夹并传递这些命令:

% pod repo update
% pod install

看起来这是CocoaPods的一个问题(至今仍未解决): https : //github.com/CocoaPods/CocoaPods/issues/7314

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

对于有此问题的科尔多瓦开发人员

尝试设置

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

在 config.xml 中

以上大部分内容对我不起作用。 如果您四处挖掘,您会发现您不应该手动运行 pod install 。 对我有用的是确保我的物理设备已使用 xcode 注册。

  • 为 ios 打开 xcode 工作区。 选择您的设备(最有可能通过 USB 连接)并单击运行。 这将提示您让 xcode 注册您的设备。
  • xcode 构建很可能会失败,这没关系 - 请参阅后续步骤
  • 退出 Xcode!
  • 光盘
  • rm -fR Podfile Podfile.lock Pod
  • 在android studio中选择有问题的设备和c

这就是我用 Firebase 10.1 和 Xcode 14.1 解决这个问题的方法:

  1. 开通Xcode
  2. Select Product > Analyze以获取所有IPHONEOS_DEPLOYMENT_TARGET警告
  3. 在您的项目目录中打开Terminal

pod cache clean --all && pod deintegrate && pod install --repo-update

  1. 再次检查 Xcode。 所有警告都应该消失,并且应该有一个来自 Xcode 的警告:“更新到推荐设置”
  2. 单击Perform Changes按钮
  3. 重启 Xcode

在 Firebase 项目库中对此有详细的讨论

首先将部署更改为您的选择:例如“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

如果有人在将 XCode 更新到 v13 后在 2021 年遇到这个问题,这里有一个对我有用的修复程序:

https://github.com/facebook/react-native/issues/31733#issuecomment-924016466

但是,这可能不适用于所有 react-native 版本,它适用于 v0.64 对我来说。

我使用 Xcode 创建了虚拟 swift 文件,因此我自动收到了“桥接头”的请求

在此处输入图像描述

希望这将在未来的版本中得到解决。

我在构建我的React Native 项目时遇到了同样的问题

cocoapods 版本更新对我有用(从 1.8.4 升级到 1.11.2)

为我工作:

rm ios/Podfile
flutter pub upgrade
flutter pub get
cd ios && pod update
flutter clean && flutter run
sudo arch -x86_64 gem install ffi
arch -x86_64 pod install 

Xcode > Runner > Info 部署目标 > IOS 部署目标:11。

打开终端:

pod cache clean --all

.

pod update

(颤动)在我的例子中,我不小心导入了 dart.js,所以如果它刚才还在工作,它只是在重新加载或重新启动时停止,请检查你的导入

对于flutter ,这是我在<project_root>/ios/Podfile

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
  
  installer.pods_project.build_configurations.each do |config|
    config.build_settings["EXCLUDED_ARCHS"] = "armv7"
    config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
  end
end

这是 M1 MacBook 上的一个已知问题。 运行颤振升级,应该可以解决它。

目前正在开发 M1 Mackbook 12.0.0 Flutter 2.10.0 Dart 2.16.0

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

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

我的模拟器OS在12.1 Xcode 10.1中

然后我更新了pod文件。

在此处输入图片说明

我的部署目标是9.0

在此处输入图片说明

在我的目标

在此处输入图片说明

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM