SIGABRT in delegate, what should I do?

I created a multi-view web browser project in Xcode. When I ran the app though I got a signal abort error in the app delegate. I know what a signal abort is, but I do not know what is causing it in this scenario. Here is the more detailed info:

  • The line in the app delegate that the debugger says the issue is in is "class AppDelegate: UIResponder, UIApplicationDelegate {".
  • Here is some of the output: "Terminating app due to uncaught exception 'NSUnknownKeyException', reason:

.FirstViewController 0x7fe64bdaa540> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key goBack.".


If needed, I can give more information. What is wrong and how should fix it? Thank you!

Please note, I did not excactly know if this was in "Xcode IDE and Editor" or "Debugger". Sorry for the inconvinience!

Answered by KMT in 156850022

>instead connect it?


From the docs https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIButton_Class/


Responding to Button Taps

Buttons use the target-action design pattern to notify your app when the user taps the button. Rather than handle touch events directly, you assign action methods to the button and designate which events trigger calls to your methods. At runtime, the button handles all incoming touch events and calls your methods in response.


You connect a button to your action method using the

addTarget:action:forControlEvents:
method or by creating a connection in Interface Builder. The signature of an action method takes one of three forms, which are listed in Listing 1. Choose the form that provides the information that you need to respond to the button tap.

The SIGABRT is not itself relevent, it's just the mechanism by which your app crashes. The real error is the exception whose message you quoted.


The error means that something is trying to access a property called "goBack" of a FirstViewController object, but that the object does not have a property of this name. Where you go from here depends a bit on your knowledge of the app. KVC (key-value coding) is normally related to UI elements updating underlying model values, but there are other possible uses, so you'll have to narrow it down a little.


One point to consider is that "goBack" sounds more like an action method name than a property name. Possibly, in Interface Builder, you bound a UI element to this name, when you meant to connect its action to an action method of this name. A binding links the value of the UI element to a property. An action links the behavior of the UI element (e.g. button push, text field Enter key) to a method.

Yes, goBack is an IBAction/button. After rewriting the code and trying again, I still have the same issue. The debug navigator says the issue is in thread 1 of the App Delegate. How should I avoid binding the UI Element to the code and instead connect it?


The goBack code is below (if that helps):

@IBAction func goBack(sender: UIButton) {
        webView.goBack()
    }



Thank You!

Well, how did you set up the binding? Did you connect something to "goBack" in Interface Builder? Or are you doing something in code?

Accepted Answer

>instead connect it?


From the docs https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIButton_Class/


Responding to Button Taps

Buttons use the target-action design pattern to notify your app when the user taps the button. Rather than handle touch events directly, you assign action methods to the button and designate which events trigger calls to your methods. At runtime, the button handles all incoming touch events and calls your methods in response.


You connect a button to your action method using the

addTarget:action:forControlEvents:
method or by creating a connection in Interface Builder. The signature of an action method takes one of three forms, which are listed in Listing 1. Choose the form that provides the information that you need to respond to the button tap.
SIGABRT in delegate, what should I do?
 
 
Q