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

Flutter项目中CocoaPods无法找到兼容FirebaseFirestore版本求助

Flutter iOS构建报错:CocoaPods无法找到兼容的FirebaseFirestore版本

运行Flutter应用时遇到以下错误:

[!] CocoaPods could not find compatible versions for pod "FirebaseFirestore":
In Podfile:
    FirebaseFirestore (from `https://github.com/invertase/firestore-ios-sdk-frameworks.git`)

    cloud_firestore (from `.symlinks/plugins/cloud_firestore/ios`) was resolved to 5.5.0, which depends on
      Firebase/Firestore (= 11.4.0) was resolved to 11.4.0, which depends on
        FirebaseFirestore (~> 11.4.0)

使用的Firebase Flutter插件版本

所有插件均为最新版:

firebase_core: ^3.8.0
firebase_analytics: ^11.3.5
firebase_storage: ^12.3.6
firebase_database: ^11.1.6
firebase_messaging: ^15.1.5
cloud_firestore: ^5.5.0

Podfile内容

# Uncomment this line to define a global platform for your project
 platform :ios, '13.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!


pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git'

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


 # target 'RunnerTests' do
   # inherit! :search_paths
 # end
end

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

已尝试的操作

  • 将Podfile中的pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git'替换为pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '11.4.0'
  • 执行以下清理和安装命令:
rm -rf build
rm -rf Pods
rm -rf Podfile.lock
rm -rf ~/.pub-cache/hosted/pub.dartlang.org/
pod cache clean all
flutter clean
flutter pub get
pod deintegrate
pod setup
rm -rf ~/Library/Caches/CocoaPods
rm -rf ~/.cocoapods

但问题仍然存在,请问接下来可以尝试什么解决方法?

Flutter Doctor输出

[✓] Flutter (Channel stable, 3.24.5, on macOS 12.7.6 21H1320 darwin-x64, locale en-TR)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.0)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.2)
[✓] Connected device (3 available)
[✓] Network resources

内容的提问来源于stack exchange,提问作者Mohammed Hamdan

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.16 02:14:57