SIGABRT Because of the FBSDK



所以我注意到FBSDK对故事板的影响很大,所以我会向您介绍我想做什么,以及当我打开应用程序时,它为什么会显示SIGABRT。

以下是我想要执行的任务:

func switchStoryboard() {
self.performSegue(withIdentifier: "LoginConnection", sender: self)
}

这就是我想要的执行方式:

override func viewDidLoad() {
super.viewDidLoad()
if FBSDKAccessToken.current() != nil {
print("User is logged in")
}
else {
self.switchStoryboard()
}

问题应该在哪里:

func loginButton(_ loginButton: FBSDKLoginButton!, didCompleteWith result: FBSDKLoginManagerLoginResult!, error: Error!) {
if (error != nil){
print(error)
return
}
FBSDKGraphRequest(graphPath: "/me", parameters: ["fields": "id, name, email"]).start { (connection, result, err) in
if (error != nil){
print("Failed to get graph request", err)
return
}
print(result)
}

嗯,我不知道。我试着调试,一切似乎都很好,但这让我很困惑,希望这里有人也犯了同样的错误,能帮助我解决这个问题,非常感谢。

用修复

if((FBSDKAccessToken.current()) != nil){
FBSDKGraphRequest(graphPath: "me", parameters: ["fields": "id, name, email"]).start(completionHandler: { (connection, result, error) -> Void in
if (error == nil){
print(result)
}
self.switchStoryboard()
print("user is not signed in")
})
}

问题是self.switchStoryboard()的功能不如print

相关内容

最新更新