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

时间:2020-09-19 20:27:55

标签: ios xcode flutter

我在项目中将所有内容都更改为9.0,但在很多吊舱中都遇到了相同的错误。

我尝试做很多不同的事情,但是没有任何效果。有谁知道我该如何解决?

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')

在构建设备时遇到错误。

12 个答案:

答案 0 :(得分:33)

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

确保您执行以下操作:

  • MinimumOSVersion中将ios/Flutter/AppFrameworkInfo.plist设置为9.0
  • 确保您取消对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

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

    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

答案 1 :(得分:14)

我用这段代码解决了,谢谢! 在PodFile的末尾

new_values

答案 2 :(得分:5)

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

您还可以尝试将flutter更新到1.22 beta,该版本支持iOS 14和XCode 12(如here所述)

答案 3 :(得分:1)

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

enter image description here

答案 4 :(得分:1)

要解决此问题,您只需将部署目标更新到 9.0。这可以通过打开 .xcworkspace 文件,在 Xcode 上选择 Pods.xcodeproj,并将 iOS 部署目标 更新到 9.0 或更高版本来更新如下图

在 Xcode 中打开 ios/Runner.xcworkspace 并更改

enter image description here

除非您导入支持文件,否则您无法在 Xcode 12 上提供对 iOS 8.0 的支持。要默认提供支持,您必须使用 Xcode 11。最好检查在 iOS 8 上使用您的应用的用户数量,并将支持的最低版本更新为 iOS 9 或更高版本。

答案 5 :(得分:1)

确保在您的任何 dart 文件中都没有导入 dart.html 包。 当 flutter 尝试安装 pod 时,这在我的情况下导致了问题。

答案 6 :(得分:1)

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

答案 7 :(得分:0)

我尝试了很多事情,但似乎为我解决的问题是:

class Solution {
    public boolean isSubtree(TreeNode s, TreeNode t) {
        /* dfs on s, at each node running a compare tree function for s at that node and
        root of t*/
        
        if(s == null || t == null) {
            return false;
        }
        
        return dfs(s, t);
    }
    
    public static boolean dfs(TreeNode s, TreeNode t) {
        if(s == null) {
            return false;
        }
        
        // ==== Corrected below if ====
        // apart from s.val == t.val, if isSameTree(s, t) is true at this
        // point, return true; otherwise keep doing dfs for rest of the tree s
        // other same value node of s can be the answer
        if(s.val == t.val && isSameTree(s, t)) {
            return true;
        }
        
        
        return dfs(s.left, t) || dfs(s.right, t);
    }
    
    public static boolean isSameTree(TreeNode s, TreeNode t) {
        if(s == null || t == null) {
            return s == t;
        }
        
        if(s.val != t.val) {
            return false;
        }
        
        return isSameTree(s.left, t.left) && isSameTree(s.right, t.right);
    }
}

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

答案 8 :(得分:0)

只需在您的 macOS 中按照以下命令行操作

  1. 扑通干净
  2. rm ios/Podfile.lock pubspec.lock
  3. rm ios/Podfile.lock pubspec.lock
  4. rm -rf ios/Pods ios/Runner.xcworkspace

答案 9 :(得分:0)

更新到 iOs 14.4 时,path_provider 包似乎与目标 10.0 不兼容。目前 Firebase 软件包需要目标 10.0.0。问题来了,我已经有一个月了。也许 Flutter 团队可以提供帮助。构建 iO 时,出现无法修复的错误,hic hic。

在调试模式下在 iPhone 12 Pro 上启动 lib/main.dart... 正在运行 pod 安装... 运行 Xcode 构建... Xcode 构建完成。 29.4s 无法构建 iOS 应用程序 Xcode 构建的错误输出: ↳ ** 构建失败 **

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 ^~~~~~~~~~~~~~~~~~~ 产生了 1 个错误。 注意:使用新的构建系统 注意:并行构建目标 注意:规划构建 注意:构建构建描述

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

答案 10 :(得分:0)

检查 Flutter.podspec 文件,并根据您的要求将版本更改为 9.0 或 10.0

答案 11 :(得分:-2)

尝试做flutter clean。它会清理xcode项目,因此应该可以解决问题。