Aiden
Aiden

Reputation: 1

Xcode Thread 1: SIGABRT: Uncaught Exception 'NSUnknownKeyException'

I am new to coding and Xcode. The problem I am facing with is stated in the title. I hope anyone can help me out of it.

The error message will be pasted at below

2015-07-13 01:11:36.443 Main_Iphone 6[2570:94488] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<Main_Iphone_6.ViewController 0x7fccc8432560> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key Button.'

First throw call stack:

(
0   CoreFoundation                      0x0000000100c02c65 __exceptionPreprocess + 165
1   libobjc.A.dylib                     0x000000010276dbb7 objc_exception_throw + 45
2   CoreFoundation                      0x0000000100c028a9 -[NSException raise] + 9
3   Foundation                          0x0000000101020b53 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 259
4   CoreFoundation                      0x0000000100b4ad50 -[NSArray makeObjectsPerformSelector:] + 224
5   UIKit                               0x00000001017794eb -[UINib instantiateWithOwner:options:] + 1506
6   UIKit                               0x00000001015d16d8 -[UIViewController _loadViewFromNibNamed:bundle:] + 242
7   UIKit                               0x00000001015d1cc8 -[UIViewController loadView] + 109
8   UIKit                               0x00000001015d1f39 -[UIViewController loadViewIfRequired] + 75
9   UIKit                               0x00000001015d23ce -[UIViewController view] + 27
10  UIKit                               0x00000001014ed289 -[UIWindow addRootViewControllerViewIfPossible] + 58
11  UIKit                               0x00000001014ed64f -[UIWindow _setHidden:forced:] + 247
12  UIKit                               0x00000001014f9de1 -[UIWindow makeKeyAndVisible] + 42
13  UIKit                               0x000000010149d417 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2732
14  UIKit                               0x00000001014a019e -[UIApplication _runWithMainScene:transitionContext:completion:] + 1349
15  UIKit                               0x000000010149f095 -[UIApplication workspaceDidEndTransaction:] + 179
16  FrontBoardServices                  0x000000010426a5e5 __31-[FBSSerialQueue performAsync:]_block_invoke_2 + 21
17  CoreFoundation                      0x0000000100b3641c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
18  CoreFoundation                      0x0000000100b2c165 __CFRunLoopDoBlocks + 341
19  CoreFoundation                      0x0000000100b2bf25 __CFRunLoopRun + 2389
20  CoreFoundation                      0x0000000100b2b366 CFRunLoopRunSpecific + 470
21  UIKit                               0x000000010149eb02 -[UIApplication _run] + 413
22  UIKit                               0x00000001014a18c0 UIApplicationMain + 1282
23  Main_Iphone 6                       0x0000000100a101d7 main + 135
24  libdyld.dylib                       0x0000000102ea3145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

Upvotes: 0

Views: 141

Answers (2)

jrturton
jrturton

Reputation: 119292

You've got an outlet called Button defined in a storyboard or xib file, but the thing you're connecting it to doesn't have a property of the same name. Either you've deleted an IBOutlet from code or you've not set the correct view controller class in the identity inspector in interface builder.

Upvotes: 1

vadian
vadian

Reputation: 285240

The most important information is this class is not key value coding-compliant for the key Button.

From the backtrace you can see, that after an UINib is instantiated

[UINib instantiateWithOwner:options:]

there is a method sent to all objects of an array

[NSArray makeObjectsPerformSelector:]

to set the value of a property Button

[NSObject(NSKeyValueCoding) setValue:forKey:]

This property must be synthesized or have explicit setter and getter to be key value coding-compliant.

Set an Exception Breakpoint to find the exact location of the crash and look into your model classes for a missing property Button

Upvotes: 0

Related Questions