当我尝试将命令添加FIRApp.configure()
到viewDidLoad()
ViewController的方法中时,我不断得到:
libc++abi.dylib: terminating with uncaught exception of type 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
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句