ios - 如何解决flutter中的iOS部署目标问题

标签 ios xcode firebase flutter dart

我正面临与 IPHONEOS_DEPLOYMENT_TARGET 相关的问题在反复为ios平台构建flutter应用程序时,我无法理解我应该如何纠正它

warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.1.99. (in target 'firebase_core' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.1.99. (in target 'firebase_auth' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.1.99. (in target 'firebase_storage' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.1.99. (in target 'firebase_messaging' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.1.99. (in target 'firebase_analytics' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.1.99. (in target 'cloud_functions' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.1.99. (in target 'cloud_firestore' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.1.99. (in target 'Flutter' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.1.99. (in target 'Firebase' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.1.99. (in target 'GoogleAppMeasurement' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.1.99. (in target 'FirebaseAnalytics' from project 'Pods')
我的 ios flutter 项目的 pod 文件在这里
# Uncomment this line to define a global platform for your project
# platform :ios, '9.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 中打开项目后检查了版本设置,但无法理解我应该如何纠正这个问题。请指导如何修复 IPHONEOS_DEPLOYMENT_TARGET

最佳答案

在您的 ./ios/Podfile取消评论:

# platform :ios, '9.0' 
platform :ios, '9.0'
将以下内容替换为
post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end
经过 :
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 
flutter pub get
cd ios && pod install
现在
  • 构建项目
  • 关闭并重新打开 Xcode
  • 关于ios - 如何解决flutter中的iOS部署目标问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64735853/

    相关文章:

    ios - UICollectionview删除项目重排怪异动画

    ios - 如何在 Xcode 4.3 上查看复制到构建文件夹的资源?

    ios - SpriteKit sktilemapnode垂直线故障

    reactjs - 收到错误 : Module not found: Can't resolve 'firebase/app'

    python - 类型错误 : Object of type 'Tag' is not JSON serializable

    iphone - 在 map View 中实现获取方向

    ios - UILabel - 自动调整大小标签以适合文本?

    ios - 当用户点击通知时从 UNNotificationRequest 显示 ViewController

    ios - tableView 显示重复值

    cocoa-touch - iOS 多任务处理 : Reductions performed by system upon entering background