Jump to content

Xcode simple multi-button error - SIGARBT Exception Thrown NSUnknownKeyException

cpuxtech

Thanks for checking this out.

Basically if I have a label and a button, I can make the method declaration in the viewcontroller.h file, and the actual code, in the viewcontroller.m file For the viewcontroller.m file I went used the code

- (IBAction)hellob1:(id)sender{ _display.text = [NSString stringWithFormat@"%@HelloButton1", _display.text]; //assuming the _display.text is the UILabel output.

} -----------------------------------------------------------------------------------------------------------------------------------------------

This all works fine, but when I try to add two buttons to add(not replace) text to the label via this code

- (IBAction)hellob1:(id)sender{

_display.text = [NSString stringWithFormat@"%@HelloButton1", _display.text]; }

- (IBAction)hellob2:(id)sender{ _display.text = [NSString stringWithFormat@"%@HelloButton2", _display.text];

}

Now when this code is implemented with the two buttons technically able to add text to the label, I get a thread1 exception thrown, SIGABRT. I can erase the code for the second button and even delete the button from the storyboard, but the program will not fix itself and will continue to crash the app in the iOS Simulator.

Like I said, it works with one button, not with two. Once I have made it with two buttons, i cannot figure out how to get it to work again with one, I have to restart the project.

Hope this makes sense, here is the output log as well for the libc++ error thing:

2013-04-18 18:35:43.545 Calculator[344:c07] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key zero.' *** First throw call stack: (0x1c92012 0x10cfe7e 0x1d1afb1 0xb7be41 0xafd5f8 0xafd0e7 0xb27b58 0x231019 0x10e3663 0x1c8d45a 0x22fb1c 0xf47e7 0xf4dc8 0xf4ff8 0xf5232 0x443d5 0x4476f 0x44905 0x4d917 0x1196c 0x1294b 0x23cb5 0x24beb 0x16698 0x1beddf9 0x1bedad0 0x1c07bf5 0x1c07962 0x1c38bb6 0x1c37f44 0x1c37e1b 0x1217a 0x13ffc 0x25bd 0x24e5) libc++abi.dylib: terminate called throwing an exception

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×