ramx
ramx

Reputation: 47

Perform logout segue

I have this error :

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CustomLogin.LogoutViewController logoutButton:]: unrecognized selector sent to instance 0x7feaf340ea70'

I have 3 VCs, of which two are ok, howeverI think that the third one - logoutviewcontroller has an error. I connect the LogOutViewController's orange UIButton to the Login View Controller and call the segue LogOut. There is the code in the LogIn View Controller:

@IBAction func loggedOut(sender: AnyObject) {

    PFUser.logOut()


    self.performSegueWithIdentifier("loggedOut", sender: self)

    var alert = UIAlertView(title: "Success", message: "You have logged out", delegate: self, cancelButtonTitle: "OK")
    alert.show()

}

What is wrong here? Thank you!

Upvotes: 2

Views: 680

Answers (1)

nburk
nburk

Reputation: 22731

Your IBAction isn't set up properly in the Storyboard. In the Storyboard, the action that is defined is linked to a method called logoutButton:, but the method in your code is called loggedOut:.

I would recommend to delete the action in Interface Builder and reconnecting it with your method in code.

Upvotes: 4

Related Questions