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

354

我在Xcode 10.1中收到以下警告信息:

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

我的模拟器系统为12.1, Xcode 10.1, 并已更新pod文件。

输入图像说明

我的部署目标为9.0

输入图像说明

在我的目标中

输入图像说明


请在 https://user-images.githubusercontent.com/5786033/45890297-f23a1d00-bdc2-11e8-885c-039432d8fbc2.png 中验证目标,请注意:该操作在框架中进行。 - Vinaykrishnan
@ Vinaykrishnan,我检查了,它是9.0。 - Naresh
5
这位朋友遇到了同样的问题,检查一下这些链接或许可以帮到你:https://github.com/flutter/flutter/issues/22123 和 https://github.com/CocoaPods/CocoaPods/issues/8069。打开你的 Xcode,在苹果图标的左上方找到 File,然后打开 Workspace Settings 并将构建系统更改为 Legacy Build System。如果你还没有尝试过这个方法,可以查看这个网址的答案:https://dev59.com/oVQK5IYBdhLWcg3wDLvP#52552878 - Vinaykrishnan
29个回答

7
你只需要取消注释下面的行。
# platform :ios, '8.0'

# platform :ios, '9.0'

然后在终端中打开iOS文件夹并执行以下命令:

% pod repo update
% pod install

对我没用。 - edn
是的!它起作用了!解决了所有烦人的错误!谢谢。 - Gal

7

Flutter 中适用的简单解决方法:

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

1
哇,这对我来说终于奏效了!谢谢你! - Sigiria

7

如果你从react-native转过来遇到了这个错误,只需要按照以下步骤操作:

  1. 打开Podfile(在你的项目中找到ios>Podfile)
  2. 将podfile中的flipper函数注释掉,如下所示
#use_flipper!
 #post_install do |installer|
   #flipper_post_install(installer)
 #end
  1. IOS文件夹内的终端输入以下命令:pod install

就是这样,希望它对你有用。


6
我解决了这个问题,我把 构建系统New Build System 改成了 Legacy Build System
在 Xcode v10+ 中,选择文件 > 项目设置。
在先前的 Xcode 中,选择 文件 > 工作区设置。
将构建系统从 New Build System 改为 Legacy Build System --> 点击完成。
请参考以下图片: enter image description here enter image description here

2
这对我来说不再是一个合适的解决方案了,因为需要使用新的构建系统(默认)来生成SwiftUI预览 :( - Ric Santos
10
这不是一个真正的解决方案。 - SmileBot
3
回归旧系统并不能解决问题。 - FaultyJuggler

2

如果要使用Flutter,请使用以下内容:

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

对我来说,问题只有在将平台更改为10(+)后才得到解决。 - Jithin U. Ahmed

2
通过更新podfile解决此问题。
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['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0' // you can change this version as per your requirments.
    end
  end
end 

你必须在podfile中使用这些行,然后你的应用程序才能运行。


1

适用于我:

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 

1

如果有人在2021年更新XCode到v13后遇到了这个问题,这里是一个对我有效的解决方法:

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

然而,这种方法可能并不适用于所有的react-native版本,但对于我来说,在v0.64上是有效的。

我使用Xcode创建了一个虚拟的Swift文件,因此自动获得了“桥接头文件”的请求。

enter image description here

希望这个问题能在未来的版本中得到解决。


1

这是我如何解决Firebase 10.1和Xcode 14.1问题的方法:

  1. 打开Xcode,选择 Product > Analyze 来获取所有的 IPHONEOS_DEPLOYMENT_TARGET 警告。关闭Xcode。
  2. /Users/YourUserName/Library/Developer/Xcode/ 目录下的 DerivedData 文件夹重命名为 DerivedData-old
  3. 在你的项目目录中打开 Terminal

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

  1. 打开Xcode。点击你的项目文件。在 TARGETS 部分选择 "Firebase"。然后进行以下更改:

Select iOS deployment target value, select 11.0, then select Other and type 10.0, then enter

所有警告都应该消失,Xcode只应该有一个警告:“更新到建议的设置”。

enter image description here

  1. 点击 执行更改 按钮
  2. 重新启动 Xcode

在 Firebase 项目存储库中有一个详细的讨论


1

以上大部分方法对我都没有用。如果你仔细查看,你会发现你不应该手动运行pod install。对我有用的是确保我的物理设备已在xcode中注册。

  • 打开iOS的xcode工作区。选择您的设备(最可能通过USB连接)并点击“运行”。这将提示您让xcode注册您的设备。
  • xcode构建很可能会失败,这没关系-请参见下一步骤
  • 退出Xcode!
  • cd ios
  • rm -fR Podfile Podfile.lock Pods
  • 在Android Studio中选择相关设备和c

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接