简体   繁体   English

使用firebase swift3时出现异常

[英]exception while using firebase swift3

I am doing such as this example in the link: 我在链接中执行此示例:

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

but I am getting this exception 但我得到这个例外

Terminating app due to uncaught exception 'FIRAppNotConfigured', reason: 'Failed to get default FIRDatabase instance. 由于未捕获的异常“ FIRAppNotConfigured”而终止应用程序,原因:“无法获取默认的FIRDatabase实例。 Must call FIRApp.configure() before using FIRDatabase. 使用FIRDatabase之前必须先调用FIRApp.configure()。

I downloaded the final project from the same page and getting the same exception even if I put GoogleService-Info.plist and enabled the keychain! 即使从GoogleService-Info.plist启用了钥匙串,我还是从同一页面下载了最终项目并获得了相同的例外!

any help is appreciated 任何帮助表示赞赏

You need to call FirebaseApp.configure() in your AppDelegate didFinishLaunchingWithOptions method, the name of firebase app now is FirebaseApp instead of FIRApp the tutorial is outdated 您需要在AppDelegate didFinishLaunchingWithOptions方法中调用FirebaseApp.configure()FIRApp应用的名称现在是FirebaseApp而不是FIRApp该教程已过时

and use this pod file content 并使用此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

also you need delete the pod folder and perform a pod install --verbose 您还需要删除pod文件夹并执行pod install --verbose

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM