I use the latest Firebase API (3.2.1) and I use this code to check if the user has been signed:
override func viewDidAppear(animated: Bool) { super.viewDidAppear(animated) if(self.navigationController != nil){ self.navigationController!.setNavigationBarHidden(true, animated: true) } if(FIRAuth.auth() != nil){ self.performSegueWithIdentifier("loginSuccessSegue", sender: self) } }
In other words, if an auth object is present, I switch to another controller. On this controller, I have an exit button that does this as follows:
do{ try FIRAuth.auth()?.signOut() self.performSegueWithIdentifier("logoutSegue", sender: self) }catch{ print("Error while signing out!") }
I do not get an error in this operation, but when I switched to the login controller, this auth object is present, and I again switched to the controller with data. I also tried checking the current user object in auth and it is present and valid.
Does anyone know how I'm going out right?
swift firebase firebase-authentication
Dejan
source share