iOS部署目标“IPHONEOS_DEPLOYMENT_TARGET”设置为8.0,在Flutter中如何更改最小的iOS部署目标?

179

我把项目里所有的东西都改成了9.0,但是很多pod仍然出现同样的错误。

我尝试了很多不同的方法,但都没有奏效。有人知道怎么解决吗?

warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is
9.0 to 14.0.99. (in target 'gRPC-C++-gRPCCertificates-Cpp' from project 'Pods')
warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is
9.0 to 14.0.99. (in target 'GoogleAppMeasurement' from project 'Pods')
warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is
9.0 to 14.0.99. (in target 'FirebaseAuth' from project 'Pods')
warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is
9.0 to 14.0.99. (in target 'GoogleUtilities' from project 'Pods')
warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is
9.0 to 14.0.99. (in target 'vibration' from project 'Pods')
warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is
9.0 to 14.0.99. (in target 'nanopb' from project 'Pods')
warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is
9.0 to 14.0.99. (in target 'BoringSSL-GRPC' from project 'Pods')
warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is
9.0 to 14.0.99. (in target 'gRPC-Core' from project 'Pods')
warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is
9.0 to 14.0.99. (in target 'gRPC-C++' from project 'Pods')

在构建设备时遇到错误。


1
请注意,这些只是警告!它们不是错误。因此,如果您的构建崩溃了,那肯定是其他问题造成的,而不是上面提到的警告。在您的构建输出中搜索单词“error”! :) - Karolina Hagegård
18个回答

1
请确保你的任何dart文件都没有导入dart.html包。 在我的情况下,这会导致flutter尝试安装Pod时出现问题。

谢天谢地,你帮我省了很多时间。有时候会不小心导入错误的东西。 - laaasBIGL

0

我最近使用nvm升级了nodejs,但在使用React Native时出现了以下错误。我尝试了所有不需要更改代码的方法。在切换回nodejs 14后,它又可以正常工作了。但这并不是根本原因。请尝试阅读错误上方的所有内容。对我来说,有一行是:

nvm is not compatible with the "npm_config_prefix" environment variable

将nvm从0.33升级到0.39后,它可以正常工作,即使使用nodejs 16也可以。


0

在尝试了大部分的解决方案后,唯一有效的方法是取消注释并在ios/Podfile中添加ios 10:

platform :ios, '10.0'

0

在我的情况下,这个错误是误导性的。

事实证明,问题是由于 Firebase 升级文档中缺少的步骤引起的:删除 XCode 中的 Fabric 构建步骤。

这是我找到的一篇文章,实际上解决了这个错误的原因:SO post 在底部提到了 Fabric 依赖项。

我按照 Firebase 文档中引用的方法添加了新的 Run Script,在 XCode 中删除了与 Fabric 相关的构建阶段,然后 8.0 目标错误就消失了。

我希望这能帮助其他像我一样深入 PodFile 依赖项的人。


0

只需在您的 macOS 中执行以下命令行

  1. flutter clean
  2. rm ios/Podfile.lock pubspec.lock
  3. rm ios/Podfile.lock pubspec.lock
  4. rm -rf ios/Pods ios/Runner.xcworkspace

0

在 /ios/Flutter/AppFrameworkInfo.plist 中将 MinimumOSVersion 更改为 9.0。

然后在 ios/Runner.xcodeproj/project.bpxproj 中的三行中将 IPHONEOS_DEPLOYMENT_TARGET = 8.0 替换为 IPHONEOS_DEPLOYMENT_TARGET = 9.0

如果您正在使用 codemagic 构建 .ipa,这也适用。


0
  1. 打开 Xcode
  2. 更改项目文档 - 项目格式 - 兼容 Xcode 8.0
  3. 执行 Flutter clean、flutter pub get 和 flutter build iOS 命令

-2

更新到 iOs 14.4 后,似乎 path_provider package 与目标 10.0 不兼容。当前 Firebase package 需要目标 10.0。问题在于,我已经遇到这个问题一个月了。也许 Flutter 团队可以帮忙解决。在构建 iOs 时,有一个无法修复的错误,唉唉。

在调试模式下启动 iPhone 12 Pro 上的 lib/main.dart... 运行 pod install... 运行 Xcode build... Xcode 构建完成。 29.4秒 构建 iOS 应用程序失败 来自 Xcode 构建的错误输出: ↳ ** BUILD FAILED **

Xcode 的输出: ↳ 从 /Users/maitrongtue/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.1/ios/Classes/FLTPathProviderPlugin.m:5 引入文件: /Users/maitrongtue/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.1/ios/Classes/FLTPathProviderPlugin.h:5:9: 致命错误:找不到“Flutter/Flutter.h”文件 #import <Flutter/Flutter.h> ^~~~~~~~~~~~~~~~~~~ 生成了 1 个错误。 注意:正在使用新的构建系统 注意:并行构建目标 注意:正在计划构建 注意:正在构建描述

无法在模拟器上构建应用程序。 在 iPhone 12 Pro 上启动应用程序时出错。


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