首页 > 解决方案 > 无法在已安装的 Firebase 组件中使用 Carthage 安装 FirebaseAuth

问题描述

在我们的项目中使用carthage (firebase/firebase-ios-sdk)安装了许多 firebase 组件,这些组件成功运行。

除了已安装的 Firebase 组件外,我们还尝试添加FirebaseAuth 。

Carthage update 命令完成且没有错误。我们做了通常的迦太基库安装步骤。我们在构建阶段向输入文件和输出文件添加了行,然后将 FirebaseAuth.framework 添加到链接框架和库。

当我们尝试构建项目时,它无法构建。

我们尝试了

还有其他几个小尝试。

我们检查过

( firebase /firebase-ios-sdk) 的程序 - 在项目目标上添加了 GoogleService-Info.plist - 在“构建设置”中的“其他链接器标志”中添加了 $(OTHER_LDFLAGS) -ObjC 标志。- 从 Link Binary With Libraries Build Phase 中删除 Firebase.framework。

购物车文件

只有firebase部分,我们安装了其他几个库。

binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseAnalyticsBinary.json" == 6.4.0
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseFirestoreBinary.json" == 6.4.0
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseMessagingBinary.json" == 6.4.0
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseAuthBinary.json" == 6.4.0

错误日志

ld: warning: Could not find auto-linked framework 'Firebase'
Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_GTMSessionFetcherService", referenced from:
      objc-class-ref in FirebaseAuth(FIRAuthBackend.o)
  "_GTMFetcherStandardUserAgentString", referenced from:
      +[FIRAuthBackend authUserAgent] in FirebaseAuth(FIRAuthBackend.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)


Showing Recent Messages
:-1: Could not find auto-linked framework 'Firebase'

:-1: Undefined symbol: _OBJC_CLASS_$_GTMSessionFetcherService

:-1: Undefined symbol: _GTMFetcherStandardUserAgentString

我们需要安装 FirebaseAuth。

我什至不确定这是否是由于尝试使用 Carthage 安装 FirebaseAuth 引起的问题。如果不可能,我们可能会使用 Cocoapods,但我们更喜欢使用 Carthage 安装 FirebaseAuth。

标签: iosfirebasefirebase-authenticationcarthage

解决方案


问题是我们没有将 Carthage 为 FirebaseAuth 创建的所有 .framework 文件添加到链接框架和库中。

添加 FirebaseAuth.framework 还不够,但我们需要添加相当多的其他 .framework 文件,例如以“Firebase...”、“Google...”和“gPRC...”开头的文件。


推荐阅读