iOS 部署目标 'IPHONEOS_DEPLOYMENT_TARGET' 设置为 8.0,在 Flutter 如何更改最小 IOS 部署目标

Raf*_*.C. 113 xcode ios flutter

我在项目中将所有内容更改为 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')
Run Code Online (Sandbox Code Playgroud)

为设备构建时遇到错误。

Je *_*ick 141

对我有用的是@raffaelli-lc 和@arhan-reddy-busam 答案的组合。

确保您执行以下操作:

  • 设置MinimumOSVersion为 9.0 英寸ios/Flutter/AppFrameworkInfo.plist
  • 确保您取消注释platform :ios, '9.0'ios/Podfile
  • 确保ios/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'
        end
      end
    end
Run Code Online (Sandbox Code Playgroud)

在进行生产构建时,以下例程对我有用:

    flutter clean \
        && rm ios/Podfile.lock pubspec.lock \
        && rm -rf ios/Pods ios/Runner.xcworkspace \
        && flutter build ios --build-name=1.0.0 --build-number=1 --release --dart-define=MY_APP_ENV=prod
Run Code Online (Sandbox Code Playgroud)

  • 我认为这真的很荒谬,我们已经手动编辑 Podfile 近一年了。但是,是的,这确实解决了问题。 (26认同)
  • `flutter clean && rm ios/Podfile.lock pubspec.lock && rm -rf ios/Pods ios/Runner.xcworkspace` 只是执行这个对我来说就成功了 (5认同)
  • 对我不起作用,出现生成 dPluginRegistrant.h:8:9: error: 'Flutter/Flutter.h' file not find #import <Flutter/Flutter.h> ^ 1 生成错误。<未知>:0:错误:未能发出预编译头 (3认同)

Raf*_*.C. 49

我用这段代码解决了,谢谢!在 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
Run Code Online (Sandbox Code Playgroud)

  • 它对我有用,但它有什么作用呢? (5认同)
  • @HarshPhoujdar我设法解决了更新我的大部分依赖项的问题。尤其是 Firebase 软件包是有问题的。它们可能与 flutter v2 不兼容。我从 firebase_core: ^0.7.0、firebase_crashlytics: ^0.4.0+1、firebase_messaging: ^8.0.0-dev.15 到 firebase_core: ^1.0.4、firebase_crashlytics: ^2.0.1、firebase_messaging: ^9.1.2 (2认同)
  • @bks 它删除了所有目标中包含的部署目标,因此将其设置为 Xcode 确定的默认值。 (2认同)

小智 15

这是因为 XCode 12 只支持构建 iOS 目标版本 9 - 14。不幸的是,flutter 设置的默认 iOS 目标是 8。但是您应该能够使用 XCode 更改 ios/Runner.xcworkspace 文件中的目标。请参阅flutter 文档部分“查看 Xcode 项目设置”-> 标题“部署目标:”。

您也可以尝试更新扑1.22 beta测试版,支持iOS的14和12的XCode(如注意这里

  • 我认为苹果需要为开发者工作,这太棘手了 (3认同)
  • 我认为 Flutter 应该在更新构建方面做得更好。^ (3认同)

inz*_*nzo 13

转到 Pods 并为您使用的每个框架更改 iOS 版本,如我的屏幕截图所示

在此处输入图片说明

  • 这是不正确的(至少不完全) - ios/Podfile 中的脚本应该自动执行此操作,请检查@“Je suis alrick”答案! (3认同)

Cad*_*doo 7

我尝试了很多方法,但似乎解决了这个问题的是:

flutter pub cache repair
Run Code Online (Sandbox Code Playgroud)

https://dart.dev/tools/pub/cmd/pub-cache

  • 我必须这样运行命令:“flutter pub 缓存修复” (2认同)