Grilled
Grilled

Reputation: 1

Signal Abort(SIGABRT) exception in Xcode

Recently I've been trying to learn how to create apps in my free time. I've been following Apple's Swift documentation along with their tutorials on creating apps. After I finished the "Connect the UI to Code" tutorial, I ran the simulator, only to receive a SIGABRT exception in my "AppDelegate" Class. I looked at the console and it says:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FoodTracker.ViewController nameTextField:]: unrecognized selector sent to instance 0x7fb572d0a040'

I even replaced my original file with Apple's file just to see if there were any differences (there weren't, with the exception of a few extra comments). Here's my ViewController class file:

class ViewController: UIViewController, UITextFieldDelegate {

//MARK: Properties

@IBOutlet weak var nameTextField: UITextField!
@IBOutlet weak var mealNameLabel: UILabel!


override func viewDidLoad() {
    super.viewDidLoad()

    // Handle the text field’s user input through delegate callbacks.
    nameTextField.delegate = self

}

//MARK: UITextFieldDelegate

func textFieldShouldReturn(_ textField: UITextField) -> Bool {
    // Hide the keyboard.
    textField.resignFirstResponder()
    return true
}

func textFieldDidEndEditing(_ textField: UITextField) {
    mealNameLabel.text = textField.text
}  

}

Upvotes: 0

Views: 592

Answers (1)

Anand
Anand

Reputation: 729

As I mentioned in my comment, you have inconsistent Storyboard to code bindings. The screenshot below shows you the exclamation points where Xcode complains. Delete and re-add them.

enter image description here

Upvotes: 1

Related Questions