每次我运行我的应用程序并单击我的Facebook登录按钮时,它会因错误而崩溃:
##Error
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController facebookbutton:]: unrecognized selector sent to instance 0x7fce2b700360'
我的视图控制器有一个按钮(facebookbutton),可以打开url中的facebook日志。
##My code for the button
@IBAction func facebookbutton(_ sender: Any) {
FBSDKLoginManager().logIn(withReadPermissions: ["email", "public_profile"], from: self) {
(loginResult: FBSDKLoginManagerLoginResult?, error: Error?) in
if error != nil {
print("Custom FB Login Failed:", error!)
return
}
}
}
我试过搜索是否搞砸了网点甚至尝试制作新按钮。我仍然得到错误。有办法解决这个问题吗?