IOS app crashes when authenticating with Firebase

My application explodes when I try to log into the iPhone from the simulator. This is a new project and I am following the Firebase docs . When I fill both input fields and then press the enter button, the simulator crashes withThread 1: breakpoint 1.1

LoginVC:

import UIKit
import Firebase
import FirebaseAuth

class LoginVC: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
    }

    @IBOutlet weak var loginEmailInput: UITextField!
    @IBOutlet weak var loginPasswordInput: UITextField!

    @IBAction func loginPressed(_ sender: Any) {
        if let email = loginEmailInput.text, let password = loginPasswordInput.text {

            FIRAuth.auth()?.signIn(withEmail: email, password: password) { (user, error) in

            }

        } // breakpoint here
    }

}

I added my application id to the Firebase console. The correct containers are installed. Posted FIRApp.configure()in didFinishLaunchingWithOptions. I am lost. Did I miss something?

I have import Firebasein AppDelegate.swift. Do I need to import it into other controllers?

+4
source share
1 answer

The following code works as expected.

import UIKit
import Firebase
import FirebaseAuth

class LoginVC: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
    }

    @IBOutlet weak var loginEmailInput: UITextField!
    @IBOutlet weak var loginPasswordInput: UITextField!

    @IBAction func loginPressed(_ sender: Any) {
        if let email = loginEmailInput.text, let password = loginPasswordInput.text {

            FIRAuth.auth()?.signIn(withEmail: email, password: password) { (user, error) in

            }

        } // breakpoint here
    }

}

, xcode . , . .

:

enter image description here

:

  • ,
  • , Delete Breakpoint
+1

Source: https://habr.com/ru/post/1664244/


All Articles