You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Flutter iOS项目编译报错:Concurrency仅支持iOS 15.0.0及以上版本

解决Flutter iOS集成Firebase时的Swift并发版本错误

问题现象

运行集成Firebase和Google Maps的Flutter iOS应用时,出现Swift编译错误:

Swift Compiler Error (Xcode): Concurrency is only available in iOS 15.0.0 or newer
/Users/rashidali/LubanPoint/ios/Pods/FirebaseStorage/FirebaseStorage/Sources/StorageReference.swift:223:28

当前Podfile内容:

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

完整报错信息:

Failed to build iOS app
Error output from Xcode build:
↳
    objc[8137]: Class AppleTypeCRetimerRestoreInfoHelper is implemented in both /usr/lib/libauthinstall.dylib (0x2012f7620) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x104524598). One of the two will be used. Which one is undefined.
    objc[8137]: Class AppleTypeCRetimerFirmwareAggregateRequestCreator is implemented in both /usr/lib/libauthinstall.dylib (0x2012f7670) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x1045245e8). One of the two will be used. Which one is undefined.

Xcode's output:
↳
    Writing result bundle at path:
        /var/folders/8r/j5l1hdxj23n759qd_g_kkfk40000gn/T/flutter_tools.eZhoD4/flutter_ios_build_temp_dirw4qaeH/temporary_xcresult_bundle

    /Users/rashidali/FlutterSdk/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-8.3.0/ios/Classes/strategies/PhonePermissionStrategy.m:50:35: warning: 'subscriberCellularProvider' is deprecated: first deprecated in iOS 12.0 [-Wdeprecated-declarations]
        CTCarrier *carrier = [netInfo subscriberCellularProvider];
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
                                      serviceSubscriberCellularProviders
    In module 'CoreTelephony' imported from /Users/rashidali/FlutterSdk/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-8.3.0/ios/Classes/strategies/PhonePermissionStrategy.m:8:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.0.sdk/System/Library/Frameworks/CoreTelephony.framework/Headers/CTTelephonyNetworkInfo.h:112:50: note: property 'subscriberCellularProvider' is declared deprecated here
    @property(readonly, retain, nullable) CTCarrier *subscriberCellularProvider API_DEPRECATED_WITH_REPLACEMENT("serviceSubscriberCellularProviders", ios(4.0, 12.0)) API_UNAVAILABLE(macos);

Result bundle written to path:
        /var/folders/8r/j5l1hdxj23n759qd_g_kkfk40000gn/T/flutter_tools.eZhoD4/flutter_ios_build_temp_dirw4qaeH/temporary_xcresult_bundle


Swift Compiler Error (Xcode): Concurrency is only available in iOS 15.0.0 or newer
/Users/rashidali/LubanPoint/ios/Pods/FirebaseStorage/FirebaseStorage/Sources/StorageReference.swift:223:28

Swift Compiler Error (Xcode): Concurrency is only available in iOS 15.0.0 or newer
/Users/rashidali/LubanPoint/ios/Pods/FirebaseStorage/FirebaseStorage/Sources/StorageReference.swift:292:24

Swift Compiler Error (Xcode): Concurrency is only available in iOS 15.0.0 or newer
/Users/rashidali/LubanPoint/ios/Pods/FirebaseStorage/FirebaseStorage/Sources/StorageReference.swift:376:28

Swift Compiler Error (Xcode): Concurrency is only available in iOS 15.0.0 or newer
/Users/rashidali/LubanPoint/ios/Pods/FirebaseStorage/FirebaseStorage/Sources/StorageReference.swift:406:58

Swift Compiler Error (Xcode): Concurrency is only available in iOS 15.0.0 or newer
/Users/rashidali/LubanPoint/ios/Pods/FirebaseStorage/FirebaseStorage/Sources/StorageReference.swift:440:23

Uncategorized (Xcode): Command CompileSwift failed with a nonzero exit code

Could not build the application for the simulator.
Error launching application on iPhone 13.

解决方案

1. 升级iOS部署目标版本

  • 编辑ios/Podfile,将第一行的platform :ios, '11.0'修改为:
    platform :ios, '15.0'
    
  • 打开Xcode,选择Runner项目,进入Build Settings,找到iOS Deployment Target,将其设置为15.0或更高版本。

2. 清理并重新安装依赖

在项目根目录依次执行以下命令:

flutter clean
cd ios
pod deintegrate
pod install
cd ..
flutter pub get

3. 处理权限警告(可选)

报错中出现的permission_handler库的API废弃警告,可通过升级该库到最新版本解决:

  • 编辑pubspec.yaml,更新permission_handler的版本号为最新稳定版
  • 执行flutter pub get更新依赖

内容的提问来源于stack exchange,提问作者Rashid Ali

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.07 20:50:26