Firebase CocoaPods 安装不工作

Firebase CocoaPods Installation Not Working

我正在尝试通过 CocoaPods 为我的 Objective-C iOS 应用程序安装 Firebase。我的 Podfile 如下:

target 'RandomName' do

pod 'Firebase/Core'
pod 'Firebase/AdMob'

end

当我 运行 pod install 时,出现以下错误:

[!] Unable to satisfy the following requirements:

- `Firebase/Core` required by `Podfile`

None of your spec sources contain a spec satisfying the dependency: `Firebase/Core`.

You have either:
 * out-of-date source repos which you can update with `pod repo update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.

已安装最新版本的 CocoaPods,我已尝试 运行ning pod repo 更新。拥有以下 Podfile 工作正常,但是当我尝试在我的 AppDelegate.m 文件中 @import Firebase; 时,Xcode 找不到模块。

target 'RandomName' do

pod 'Firebase'

end

但是,以下组合不安装:

target 'RandomName' do

pod 'Firebase'
pod 'Firebase/AdMob'

end

如有任何帮助,我们将不胜感激!

你试过添加

框架 use_frameworks!

在目标 'RandomName' 行之后

并添加

平台:ios,'9.0'

在目标之前....

有几样东西可以尝试。从你的问题来看,你确实尝试了前两项,但为了我的回答的完整性而离开这里。

  • 您收到的错误响应很有帮助。按照 pod repo update

  • 的步骤操作
  • 确保您的 pod 是最新的。

    pwd> pod --version
    1.0.0
    
  • 确保您的 git 是最新的。我的构建机器有一个过时的 git (1.7),我有同样的错误

  • -

当我从 git 1.7 更新到这个版本时,它工作正常。

pwd> git --version
git version 2.8.1
  • 我使用 Firebase 动态链接的 Podfile
  • 运行 pod init 来自您的 .xcodeproj 所在的文件夹
  • 确保从这里只启动 .xcworkspace 而不是 .xcodeproj。
platform :ios, '8.0'
use_frameworks!

target 'the-name-of-target' do
 pod 'Firebase/DynamicLinks'
end

我正在执行以下步骤来修复此错误:

$pod setup -- verbose

然后$pod install

对我有用,我的 pod 文件是:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

target 'the-name-of-target' do
 pod 'Eureka', '~> 1.6'
end

更新:

然后您可以使用以下代码删除您的 master 并重新安装 cocoapods:

cd ~/.cocoapods/repos
rm -rf master
pod setup

我有同样的错误,我的解决方案是将 Cocoapods 降级为 1.0.0,因为 Cocoapods 1.0.1 没有像我预期的那样工作。现在一切正常!

  • sudo gem uninstall cocoapods -v 1.0.1

  • sudo gem install cocoapods -v 1.0.0

我的Podfile:

platform :ios, '8.0'

target 'XXX' do

  pod 'Firebase/Auth'
  pod 'Firebase/Database'

end

使用 pod 'Firebase' 检查安装的 Firebase 版本。对我来说,它安装了 2.4.3,这是一个旧版本。文档说 pod 应该使用那个 pod 安装 3.2。它解释了为什么其他 pods 不起作用,因为它们是 Firebase 3 的一部分。Pod 更新也不会将 Firebase 更新到最新版本。即使强制一个版本也行不通。它似乎无法找到新的 Firebase 版本,即使它们在相同的 podspec.

我是这样解决的:

  • 确保您安装了最新版本的 git

  • 确保你安装了 cocoapods >= 1.0.0

  • 删除您的 pods 存储库 (运行 pod repo remove master) 并使用 pod setup 创建一个新的

  • 在您的 pod 文件中使用以下内容

    pod 'Firebase/Auth'

    pod 'Firebase/Database'

    pod 'Firebase/Core'

(随便用,别用'Firebase')

  • pod install
  • 一切都应该正确安装

运行 'pod repo remove master' 删除 Pods 仓库 //删除库

运行 'pod setup' //克隆更新的 git 规范的 repo,这需要很长时间,因为它的大小超过 300K(请耐心等待!)

运行 'pod install' //问题解决

使用 pod install 命令时出现同样的问题。

请重新启动终端并导航至您的 Xcode 项目,然后

只需启动相同的 pod install 命令。 'Firebase/Database' 将安装成功:)

对于仍然对此有疑问的人。直接复制firebase walkthourgh网站时,安装字符串为:

pod `Firebase/Core`

本来应该是:

pod 'Firebase/Core'

如果这也适用于您,则无需设置 pod。

GitCocoapods更新到最新版本:

Git: $ brew update && brew upgrade

椰子类:$ pod repo update