gpt4 book ai didi

ios - Firebase 未配置 iOS

转载 作者:行者123 更新时间:2023-11-29 00:51:23 25 4
gpt4 key购买 nike

当我尝试将命令 FIRApp.configure() 添加到 ViewController 中的 viewDidLoad() 方法时,我不断得到:

libc++abi.dylib:以 NSException 类型的未捕获异常终止

这是我的代码:

import UIKit
import Firebase
import FirebaseDatabase


class ViewController: UIViewController {
@IBOutlet weak var usernameTextField: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
// if UserDefaults.standard().string(forKey: "username") != nil {
// performSegue(withIdentifier: "userInfoSegue", sender: self) }
FIRApp.configure()
}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}

最佳答案

您应该在 AppDelegate 中调用此方法。

从文档中我们可以看出,configure应该在应用启动后调用。所以将它放在 application(_:didFinishLaunchingWithOptions:) 中是最有意义的,因为该方法在应用程序启动时被调用!

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
FIRApp.configure()
return true
}

关于ios - Firebase 未配置 iOS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38115512/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com