[英]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? 当我按继续按钮而不是看到“退出按钮”和同一页面时,我想在iOS应用中使用Facebook登录后进入下一页/视图控制器,我该怎么做?
I tried adding segue here 我试图在这里添加segue
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 尝试在主线程中调用performSegue
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)
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.