0

So I'm try to set up a login func (which worked) but when I test the login, I get to the login screen and login in. Then It shows a black screen.

    func login(){

    FIRAuth.auth()?.signInWithEmail(Username.text!, password: Password.text!, completion: {

        user, error in

        if error != nil{

            print("Incorrect Username/Password")

        }
        else{

            print("Welcome")
            self.presentViewController(vc, animated: true, completion: nil)




        }

    })

}

Can anybody tell me what I am doing wrong. The signInWithEmail part doesn't affect the UIview.

  • 2
    is signInWithEmail call your completion closure on a background thread? – FouZ Jul 27 '16 at 14:49
  • ^^^ I believe @FouZ has the right idea... you need to present the view controller on the main thread – MSU_Bulldog Jul 27 '16 at 14:59
  • 1
    Possible duplicate of [presentViewController shows black page](http://stackoverflow.com/questions/15621619/presentviewcontroller-shows-black-page) – xenteros Aug 04 '16 at 19:37

1 Answers1

0

Storyboard name I'm new to this but the following answer worked for me

 let NextView = self.storyboard?.instantiateViewControllerWithIdentifier("xyzVC") as! xyzVC

 self.presentViewController(NextView, animated: true, completion: nil)

used the following answer https://stackoverflow.com/a/30248306/6679536

again, I'm new, so maybe this will create issues in the future! make sure you call the ViewController in storyboard the exact same name, as shown in the picture... otherwise you will get a huge error.

Community
  • 1
  • 1
H_N
  • 32
  • 2