简体   繁体   中英

Why am I getting a black screen when I use self.presentViewController(vc, animated: true, completion: nil) Xcode swift 2

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM