Reputation: 43
so this is what's happening, I've got two scenes in my storyboard, scene one is a login form, and scene two is a form which calls a NSURLSession (that scene isn't the issue however)
What is happening, is when I click the Login button on the first scene, the app crashes, what should happen is the login credentials should be checked against the (currently hardcoded) user credentials, if they are correct, a segue should send the user to the second scene.
This is the error log data;
2014-10-01 17:24:51.454 TotalSMSAPP[15443:446622] -[TotalSMSAPP.ViewController1 activateLogin:]: unrecognized selector sent to instance 0x7f88d3424620 2014-10-01 17:24:51.459 TotalSMSAPP[15443:446622] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[TotalSMSAPP.ViewController1 activateLogin:]: unrecognized selector sent to instance 0x7f88d3424620'
This is the code applicable to the problematic scene;
import Foundation
import UIKit
class ViewController1: UIViewController {
@IBOutlet var username: UITextField!
@IBOutlet var password: UITextField!
@IBAction func login(sender: UIButton) {
if(username.text == "koharu" && password.text == "test"){
self.performSegueWithIdentifier("toSMS",sender: self)
}else{
}
}
}
Upvotes: 1
Views: 69
Reputation: 27345
'NSInvalidArgumentException', reason: '-[TotalSMSAPP.ViewController1 activateLogin:]: unrecognized selector sent to instance 0x7f88d3424620'
This error states that activateLogin:
is called while you have defined login:
. It could happen if you renamed the method. Remove the button action and reconnect it again with @IBAction func login(sender: UIButton)
.
Upvotes: 2
Reputation: 108169
When the button is pressed it tries to call the method activateLogin:
, but you haven't provided one. Probably you connected the button to the activateLogin:
action and then you renamed it.
Simply go in Interface Builder, remove the reference to the old method and make a new one to login:
instead.
Upvotes: 0
Reputation: 229
Make sure that you have a segue with this identifier. And also override prepareForSegue method which will help you debug.
Upvotes: 0