Search code examples
iosswiftsigabrt

Why is IBAction throwing exception?


import UIKit

class LoginViewController: UIViewController {
    @IBAction func btnActionLogin(_ sender: Any?) {
        print("Why is this error?")
    }
}

After connecting the button to my view controller, when I tap the button, the app keeps crashing with an Error: (Thread 1: signal SIGABRT)

Why? I am just connecting the button from the storyboard to the code like normal..


Solution

  • Make sure the Module part is not None and set to your target name in addition to class set to Your custom class name

    enter image description here