Ever get this error?
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UhOh.ViewController fireStarted:]: unrecognized selector sent to instance 0x7fe677009df0
A selector is basically a name of a method. So the fireStarted
method of the ViewController
wasn’t found so, the app crashed with that exception.
First look for when this exception was triggered. In my case it was right after hitting a button. So my next check was the storyboard. Click on the button that caused the exception and open up the Connections inspector. Look for the events associated to that button.
Now open up the associated view controller.
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
}
Notice how the fireStarted method isn’t implemented as an @IBAction in your view controller? That’s the problem. Just link it up again and you should be fine.
Now you should have:
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
@IBAction func fireStarted(_ sender: UIButton) {
}
}
Just build and you’re good to go!