首页 文章

Firebase(4.0.0):安装FirebaseDatabase时使用未解析的标识符FirebaseApp

提问于
浏览
23

这是发生的事情:

  • 在Xcode版本7.3.1(7D1014)上运行

  • pod 'Firebase/Core'

  • 导入类中的Firebase

unresolved on Database

然后我添加了数据库框架

  • pod 'Firebase/Core'

  • pod 'Firebase/Database'

unresolved on FirebaseApp

似乎2个框架处于互斥模式 . 他们不能共存 .

我已经尝试了一切:更新,安装,卸载,重新创建项目,重新创建工作区 . 所有 .

愿你帮助我 . 上次Firebase版本是否有错误?

9 回答

  • 2
    import FirebaseCore
    

    然后你可以使用 FirebaseApp.configure() . 我正在使用swift 4 .

  • 10

    pod 'Firebase/Core' 替换为 pod 'Firebase' . 然后运行 pod repo update .

  • 0

    我在podfile中添加了'Firebase'和'Firebase / Core',它对我有用

  • 3

    它对我有用

    pod repo update
    pod update
    

    然后运行 at the location of the pod file

    pod install
    

    重建我的应用程序后,错误应该消失 .

  • 4

    我有一个类似的问题 .

    你的进口声明是:

    import Firebase
    

    确保重新启动Xcode并清理构建文件夹 .

    它正在为我工作并摆脱“使用未解析的标识符FirebaseApp ...”错误

    Update: 对于Swift 4.2: FirebaseApp.configure() 确实有效 . [FIRApp重命名为FirebaseApp]

  • 4

    听起来您可能正在使用较旧版本的Firebase . 试试 -

    pod repo update
    pod update
    

    仔细检查Firebase 4.0正在安装中 .

    还尝试导入特定模块 . 因此,而不是 import Firebase 使用 import FirebaseDatabaseimport FirebaseAuth .

  • 23

    使用FIRApp.configure()而不是Firebase.configure()

  • 4
    sudo gem install cocoapods
    pod update
    
  • 70

    今天我的工作:

    1. in Xcode 9.1

    import UIKit
    import Firebase
    import UserNotifications
    import FirebaseInstanceID
    import FirebaseMessaging
    import FirebaseCrash
    import FirebaseAnalytics
    
    
    @UIApplicationMain
    class AppDelegate: UIResponder, UIApplicationDelegate {
    
        var window: UIWindow?
    
    
        func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    
            FirebaseApp.configure()
    
            return true
        }
    

    2. My PodFile

    pod 'Firebase'
      pod 'Firebase/Core'
      pod 'Firebase/Database'
      pod 'Firebase/Crash'
      pod 'Firebase/RemoteConfig'
      pod 'Firebase/Storage'
      pod 'FirebaseUI', '~> 4.0'
      pod 'Firebase/Auth'
      pod 'Firebase/Messaging'
    

    3. finale:

    pod repo update
    pod update
    

    4. restart xcode:

    5. press: shift-alt-command-k (in xcode)

    这将删除构建文件夹中的所有产品和中间文件 . 它与删除派生数据不同 .

    6. an clean

    DONE

相关问题