首页 > 解决方案 > Flutter 在不支持的 iOS 版本上运行

问题描述

我刚刚生成了一个新的 podfile 并安装了一个带有 iOS 10 的模拟器。podfile 的 ios 平台版本设置为 11.0,但是当我在 ios 10 模拟器上运行时,它会安装并打开(尽管崩溃)。为什么没有构建/安装错误,因为模拟器版本低于 podfile 平台版本。

# Uncomment this line to define a global platform for your project
platform :ios, '11.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end

我是不是做错了什么,这让我发疯。

- 编辑

在 xcode 的 ios 文件夹中更新以下下拉列表 在此处输入图像描述

产生以下差异

+++ b/example/ios/Flutter/AppFrameworkInfo.plist
@@ -21,6 +21,6 @@
   <key>CFBundleVersion</key>
   <string>1.0</string>
   <key>MinimumOSVersion</key>
-  <string>8.0</string>
+  <string>11.0</string>
 </dict>
 </plist>


+++ b/example/ios/Runner.xcodeproj/project.pbxproj
@@ -3,7 +3,7 @@
        archiveVersion = 1;
        classes = {
        };
-       objectVersion = 50;
+       objectVersion = 51;
        objects = {
 
 /* Begin PBXBuildFile section */
@@ -370,6 +370,7 @@
                                        "$(PROJECT_DIR)/Flutter",
                                );
                                INFOPLIST_FILE = Runner/Info.plist;
+                               IPHONEOS_DEPLOYMENT_TARGET = 11.0;
                                LD_RUNPATH_SEARCH_PATHS = (
                                        "$(inherited)",
                                        "@executable_path/Frameworks",
@@ -507,6 +508,7 @@
                                        "$(PROJECT_DIR)/Flutter",
                                );
                                INFOPLIST_FILE = Runner/Info.plist;
+                               IPHONEOS_DEPLOYMENT_TARGET = 11.0;
                                LD_RUNPATH_SEARCH_PATHS = (
                                        "$(inherited)",
                                        "@executable_path/Frameworks",
@@ -538,6 +540,7 @@
                                        "$(PROJECT_DIR)/Flutter",
                                );
                                INFOPLIST_FILE = Runner/Info.plist;
+                               IPHONEOS_DEPLOYMENT_TARGET = 11.0;
                                LD_RUNPATH_SEARCH_PATHS = (
                                        "$(inherited)",
                                        "@executable_path/Frameworks",




但是在ios 10模拟器上安装还是很开心的

标签: iosswiftflutter

解决方案


推荐阅读