user3390652
user3390652

Reputation: 142

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..

Upvotes: 0

Views: 117

Answers (2)

Shehata Gamal
Shehata Gamal

Reputation: 100503

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

Upvotes: 2

Mridul Gupta
Mridul Gupta

Reputation: 609

Please look at this link : Swift error : signal SIGABRT how to solve it

and follow second answer. Suspecting you have connected another action or so and might have deleted it by mistake.Attached a picture, replicating your scenraio, Please look at it

Upvotes: 0

Related Questions