【问题标题】:exception while using firebase swift3使用firebase swift3时出现异常
【发布时间】:2018-06-18 14:22:30
【问题描述】:

我正在做这样的链接中的例子:

https://www.raywenderlich.com/139322/firebase-tutorial-getting-started-2

但我得到了这个异常

由于未捕获的异常“FIRAppNotConfigured”而终止应用程序,原因:“无法获取默认 FIRDatabase 实例。在使用 FIRDatabase 之前必须调用 FIRApp.configure()。

我从同一页面下载了最终项目并得到了相同的异常,即使我放了 GoogleService-Info.plist 并启用了钥匙串!

感谢任何帮助

【问题讨论】:

  • 你需要在你的AppDelegatedidFinishLaunchingWithOptions方法中调用FirebaseApp.configure(),firebase应用的名字现在是FirebaseApp而不是FIRApp教程已经过时了
  • 如果你能分享你的虚拟项目就更好了。
  • @ReinierMelian 你是对的,我像他一样使用 FIRApp,但是当我使用 FirebaseApp 时,它给了我 >> 使用未解析的标识符“FirebaseApp”
  • 你import Firebase了吗??
  • 您将 firebase 与 cocoapods 集成还是手动集成?

标签: ios swift firebase firebase-realtime-database firebase-authentication


【解决方案1】:

你需要在你的AppDelegatedidFinishLaunchingWithOptions方法中调用FirebaseApp.configure(),firebase应用的名字现在是FirebaseApp而不是FIRApp教程已经过时了

并使用这个 pod 文件内容

project 'Grocr.xcodeproj'

# Uncomment the next line to define a global platform for your project
platform :ios, '10.0'

target 'Grocr' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for Grocr
  pod 'Firebase/Core'
end

您还需要删除 pod 文件夹并执行 pod install --verbose

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-12-10
    • 1970-01-01
    • 1970-01-01
    • 2011-10-15
    • 2015-02-05
    • 2014-08-06
    • 1970-01-01
    相关资源
    最近更新 更多