简体   繁体   中英

How can I use Facebook login in my app and move to next page/view controller after successfully logIn?

I would like to go to next page/view controller after I log in with Facebook in my iOS app when I press the continue button instead of seeing the "log out button” and the same page. How would I do that?

I tried adding segue here

   func loginButton(_ loginButton: FBSDKLoginButton!, didCompleteWith result: FBSDKLoginManagerLoginResult!, error: Error!) {
    if error != nil {
        print(error)
        return
    }
    performSegue(withIdentifier: "segueVC", sender: nil)
    print("sucessfully logged in with FB")


}

But it didn't work. Thanks a lot!

Try to call performSegue in main thread

class ViewController:UIViewController {


 func loginButton(_ loginButton: FBSDKLoginButton!, didCompleteWith result: FBSDKLoginManagerLoginResult!, error: Error!) {

   if error != nil {
     print(error)
     return
   }

   DispatchQueue.main.async {
     performSegue(withIdentifier: "segueVC", sender: nil)
   }
 }


}

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