Reputation: 45
Everytime I run my app and click my facebook log in button it crashes due to error:
##Error
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController facebookbutton:]: unrecognized selector sent to instance 0x7fce2b700360'
My view controller has a button(facebookbutton) which is suppose to open up the facebook log in url.
##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
}
}
}
The error pops up in app delegate
I've tried searching if i messed up the outlets and even tried making a new button. I'm still getting the error. Is there a way to solve this?
Upvotes: 0
Views: 1948
Reputation: 11928
You most likely forgot to set your custom view controller class to match the one you created in the storyboard. I’ve attached a screen shot to help you out. Replace where it says ‘MyViewControler’ with whatever your view controllers class is that contains the method facebookButton
Upvotes: 1