【问题标题】:Cannot find 'FirebaseApp' in scope using Carthage instead of CocoaPods使用 Carthage 而不是 CocoaPods 在范围内找不到“FirebaseApp”
【发布时间】:2021-11-10 17:10:22
【问题描述】:

有几天我一直在将我的应用程序的依赖管理软件从 CocoaPods 迁移到 Carthage,问题是 我不知道如何导入“Firebase”模块,因为没有名为 的二进制文件>FirebaseCore 或仅 Firebase

以下内容来自我的购物车文件

github "Alamofire/Alamofire" ~> 5.4.3
github "realm/realm-cocoa" ~> 10.12.0
github "onevcat/Kingfisher" ~> 6.3.1
github "hackiftekhar/IQKeyboardManager"
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseAppCheckBinary.json"
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseAuthBinary.json"
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseRemoteConfigBinary.json"

一切正常,但是当我尝试时在我的 AppDelegate 中:

FirebaseApp.configure()

它返回以下错误: Cannot find 'FirebaseApp' in scope 因为我无法导入 CocoaPods 中可用的模块 Firebase。 我尝试包含来自this link 的不同二进制文件,但没有任何结果。

【问题讨论】:

    标签: ios swift firebase config carthage


    【解决方案1】:

    一段时间后,我发现要访问 FirebaseApp 以及 Firebase 模块以进行导入,您必须包含 FirebaseAnalytics 的二进制文件,该二进制文件似乎包含 FirebaseCore 和 Firebase 模块。

    binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseAnalyticsBinary.json"
    

    将其添加到 Cartfile 后,您只需在 AppDelegate 中输入import Firebase,然后 FirebaseApp.configure() 将再次起作用。

    【讨论】:

      猜你喜欢
      • 2021-09-17
      • 2021-07-11
      • 2020-11-23
      • 2021-06-18
      • 2021-01-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多