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

Unity构建CocoaPods安装失败:无法找到Firebase/Analytics 10.0.0依赖

Unity集成Firebase Analytics时CocoaPods安装失败的修复方案

我们使用Unity 2020.3.8f1版本开发,尝试集成Firebase Analytics时,构建项目遭遇CocoaPods安装失败,报错信息如下:

None of your spec sources contain a spec satisfying the dependency: Firebase/Analytics (= 10.0.0).

You have either:

  • out-of-date source repos which you can update with pod repo update or with pod install --repo-update.
  • mistyped the name or version.
  • not added the source repo that hosts the Podspec to your Podfile.

Ignoring ffi-1.13.1 because its extensions are not built. Try: gem pristine ffi --version 1.13.1
Ignoring json-1.8.6 because its extensions are not built. Try: gem pristine json --version 1.8.6

pod repo update output:

Updating spec repo cocoapods
$ /usr/bin/git -C /Users/josephhopkins/.cocoapods/repos/cocoapods fetch origin --progress
$ /usr/bin/git -C /Users/josephhopkins/.cocoapods/repos/cocoapods rev-parse --abbrev-ref HEAD
master
$ /usr/bin/git -C /Users/josephhopkins/.cocoapods/repos/cocoapods reset --hard origin/master
HEAD is now at 7b2edeb16678 [Add] SwiftCurrent 5.1.10
Updating spec repo trunk

CocoaPods 1.11.3 is available.
To update use: gem install cocoapods

已尝试执行pod repo update命令及删除Library缓存文件夹,问题仍未解决,可尝试以下修复步骤:

  • 升级CocoaPods版本
    报错提示存在可用的CocoaPods 1.11.3版本,旧版本可能无法识别Firebase 10.0.0的spec。执行以下命令升级:

    sudo gem install cocoapods
    

    升级完成后,重新执行仓库更新:

    pod repo update --verbose
    
  • 修复Ruby依赖扩展问题
    报错中提到ffi和json的扩展未构建,这会影响CocoaPods的正常运行,执行命令修复:

    gem pristine ffi --version 1.13.1
    gem pristine json --version 1.8.6
    

    如果修复无效,建议使用rbenv或rvm重新安装Ruby环境,避免系统Ruby的权限和版本冲突问题。

  • 调整Podfile配置
    找到Unity生成的iOS项目中的Podfile,确认已添加官方源:

    source 'https://cdn.cocoapods.org/'
    

    同时尝试降低Firebase Analytics的版本(比如改为9.x系列),因为新版本可能与旧版CocoaPods不兼容。可以在Podfile中手动修改依赖版本,或者在Unity的Firebase插件设置中调整版本后重新生成项目。

  • 彻底清理缓存并重新构建
    清理所有CocoaPods缓存:

    pod cache clean --all
    

    删除Unity项目的iOS构建目录,重新生成Xcode项目,然后进入项目目录执行:

    pod install --repo-update
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.13 12:30:58