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

iOS集成firebase_messaging 10.0.0时Podfile相关编译报错无法启动应用

问题解决方法

这个报错是firebase_messaging 10.0.0版本和项目中拉取的GoogleUtilities依赖版本不兼容导致的,firebase_messaging 10.x及以上版本要求GoogleUtilities版本≥7.2.0,且最低支持iOS 11系统,你当前Podfile的配置不满足这两个要求,才会出现模块定义不可达的编译错误。

具体操作步骤
  • 执行flutter clean清理项目本地构建缓存
  • 进入项目ios目录,删除Podfile.lock文件、Pods文件夹、Runner.xcworkspace文件
  • 修改Podfile配置:
    1. 把顶部的platform :ios, '10.0'修改为platform :ios, '11.0',匹配firebase_messaging 10.0.0的最低系统要求
    2. 在target 'Runner' do代码块中,use_modular_headers!下方新增一行pod 'GoogleUtilities', '~> 7.7.0',强制指定兼容的GoogleUtilities版本
  • 仍在ios目录下执行pod repo update更新本地CocoaPods的依赖索引
  • 执行pod install重新安装所有iOS依赖
  • 回到项目根目录执行flutter run重新启动项目即可
异常情况补充

如果执行完上述步骤仍有编译报错,打开Xcode中的Runner.xcworkspace,进入Build Settings页面,搜索Other Linker Flags,确认配置项中存在-ObjC参数,不存在则手动添加后重新构建即可。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.09.29 10:57:04