Search code examples
iosiphoneswiftswift3

Click button getting error : unrecognized selector sent to instance - IOS Swift 3


Click button getting error : unrecognized selector sent to instance - IOS Swift 3

import UIKit
class Login: UIViewController {
override func viewDidLoad() {
    super.viewDidLoad()

    // Do any additional setup after loading the view.
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

@IBAction func LoginButton(_ sender: UIButton) {
    print("Login button")
}}

Error 2017-04-05 14:55:56.965 Design[3510:67974] Unknown class Login in Interface Builder file. 2017-04-05 14:56:00.084 Design[3510:67974] -[UIView LoginButton:]: unrecognized selector sent to instance 0x7ffa2f70c9b0 2017-04-05 14:56:00.093 Design[3510:67974] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView LoginButton:]: unrecognized selector sent to instance 0x7ffa2f70c9b0' * First throw call stack: ( .... ) libc++abi.dylib: terminating with uncaught exception of type NSException

Image : enter image description here I am beginner in IOS app development


Solution

  • I solved Thanks to everyone, Problem was when i am making connection - On object selection there was to 2 options First VC controller "Login" and second one only "Login" (default selecting). I just changed defualt "Login" to VC "Login".

    Default object

    2 types of options

    After selected VC Login