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

Flutter从2.x升级到3.3.8后iOS模拟器编译报错:找不到FirebaseInstallations

Flutter升级后iOS编译报错:clang找不到FirebaseInstallations的解决方案
  • 彻底清理iOS端缓存和依赖

    1. 在Flutter项目根目录执行:
      flutter clean
      
    2. 进入ios目录,删除旧的Pod锁文件和依赖文件夹:
      cd ios
      rm -rf Podfile.lock Pods
      
    3. 清理Xcode的派生数据,要么通过Xcode菜单File > Project Settings > Derived Data点击删除,要么执行命令:
      rm -rf ~/Library/Developer/Xcode/DerivedData
      
  • 调整Podfile配置

    1. 确保Podfile开头的iOS平台版本不低于Firebase要求的最低版本,比如设置:
      platform :ios, '13.0'
      
    2. 删掉之前手动加的FirebaseFirestore的git配置,当前cloud_firestore版本自带兼容的iOS SDK,不需要单独指定。
    3. 在Podfile里显式添加FirebaseInstallations依赖,版本和其他Firebase组件保持一致:
      pod 'FirebaseInstallations', '~> 10.2.0'
      
    4. 更新本地pod仓库并重新安装:
      pod install --repo-update
      
  • 统一Firebase依赖版本
    打开项目根目录的pubspec.yaml,把Firebase相关依赖更新到最新兼容版本,比如:

    firebase_core: ^2.15.0
    firebase_messaging: ^14.6.0
    cloud_firestore: ^4.8.2
    

    执行flutter pub get拉取新依赖,再回到ios目录重新跑pod install。

  • 检查Xcode项目配置

    1. 打开ios目录下的Runner.xcworkspace,进入Build Phases > Link Binary With Libraries,确认里面有FirebaseInstallations.framework,没有的话从Pods/FirebaseInstallations目录里拖进去。
    2. 查看Build Settings > Framework Search Paths,确保包含$(inherited)和$(PROJECT_DIR)/Pods/FirebaseInstallations,缺的话补上。
  • 重新编译运行
    回到Flutter项目根目录,执行flutter run试试。

内容的提问来源于stack exchange,提问作者Ahmad Raza

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.11 10:00:24