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

Flutter用Codemagic打iOS包报错cloud_firestore模块未找到如何处理

修复方案
  • 第一步:修改Podfile配置
    你当前Podfile存在两个问题:
    1. iOS最低版本过低,cloud_firestore 官方要求最低支持iOS 12.0及以上,需要把platform :ios, ’10.0’改为platform :ios, '12.0',注意把中文单引号替换为英文单引号
    2. 缺失Flutter插件自动引入的配置块,在use_frameworks!下方添加如下代码:
    use_modular_headers!
    flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
    
    修改完成后的完整Podfile参考:
    # Uncomment the next line to define a global platform for your project
    platform :ios, '12.0'
    
    target 'Runner' do
      # Comment the next line if you don't want to use dynamic frameworks
      use_frameworks!
      use_modular_headers!
      flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
      # Pods for Runner
    end
    
  • 第二步:调整代码仓库的忽略配置
    把iOS目录下的Pods文件夹、Podfile.lock、Runner.xcworkspace加入.gitignore,不要提交本地Windows环境生成的iOS依赖文件,避免文件兼容问题。
  • 第三步:配置Codemagic的前置构建脚本
    在Codemagic的构建流程的iOS构建步骤前,添加如下执行命令,让构建机自动生成正确的iOS依赖:
    flutter pub get
    cd ios
    pod deintegrate
    pod cache clean --all
    pod install
    cd ..
    
  • 第四步:校验Codemagic构建设置
    确认Codemagic的iOS构建配置中,构建使用的是Runner.xcworkspace 而不是Runner.xcodeproj,构建Scheme选择Runner。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.10.01 06:45:04