This question already has answers here:
Xcode - How to fix 'NSUnknownKeyException', reason: … this class is not key value coding-compliant for the key X" error?
(79 answers)
Closed 7 years ago.
I've began to program an iOS application, but I ran into a sudden problem. The program worked as intended, I had a single view application, with navigation bar with title Title. When I compiled it, it was okay, but then I decided to "retitle" the title bar to say Hello. And after that I've got an error without a slightest idea what for, cause it worked like a minute before this error and the only change was the title of the title bar.
here is the error
Terminating app due to uncaught exception 'NSUnknownKeyException', reason:
[<MapViewController 0xa964410> setValue:forUndefinedKey:]: this class is not key
value coding-compliant for the key titleText.'
*** First throw call stack:
(
0 CoreFoundation 0x027a51e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x025248e5 objc_exception_throw + 44
2 CoreFoundation 0x02834fe1 -[NSException raise] + 17
3 Foundation 0x021e4d9e -[NSObject(NSKeyValueCoding) setValue:forUndefinedKey:] + 282
4 Foundation 0x021511d7 _NSSetUsingKeyValueSetter + 88
5 Foundation 0x02150731 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 267
6 Foundation 0x021b2b0a -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 412
7 UIKit 0x0149b1f4 -[UIRuntimeOutletConnection connect] + 106
8 libobjc.A.dylib 0x025367de -[NSObject performSelector:] + 62
9 CoreFoundation 0x027a076a -[NSArray makeObjectsPerformSelector:] + 314
10 UIKit 0x01499d4d -[UINib instantiateWithOwner:options:] + 1417
11 UIKit 0x013026f5 -[UIViewController _loadViewFromNibNamed:bundle:] + 280
12 UIKit 0x01302e9d -[UIViewController loadView] + 302
13 UIKit 0x013030d3 -[UIViewController loadViewIfRequired] + 78
14 UIKit 0x013035d9 -[UIViewController view] + 35
15 UIKit 0x01223267 -[UIWindow addRootViewControllerViewIfPossible] + 66
16 UIKit 0x012235ef -[UIWindow _setHidden:forced:] + 312
17 UIKit 0x0122386b -[UIWindow _orderFrontWithoutMakingKey] + 49
18 UIKit 0x0122e3c8 -[UIWindow makeKeyAndVisible] + 65
19 Anchor-It 0x00005a39 -[AppDelegate application:didFinishLaunchingWithOptions:] + 585
20 UIKit 0x011de14f -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 309
21 UIKit 0x011deaa1 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1810
22 UIKit 0x011e3667 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 824
23 UIKit 0x011f7f92 -[UIApplication handleEvent:withNewEvent:] + 3517
24 UIKit 0x011f8555 -[UIApplication sendEvent:] + 85
25 UIKit 0x011e5250 _UIApplicationHandleEvent + 683
26 GraphicsServices 0x0381df02 _PurpleEventCallback + 776
27 GraphicsServices 0x0381da0d PurpleEventCallback + 46
28 CoreFoundation 0x02720ca5 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
29 CoreFoundation 0x027209db __CFRunLoopDoSource1 + 523
30 CoreFoundation 0x0274b68c __CFRunLoopRun + 2156
31 CoreFoundation 0x0274a9d3 CFRunLoopRunSpecific + 467
32 CoreFoundation 0x0274a7eb CFRunLoopRunInMode + 123
33 UIKit 0x011e2d9c -[UIApplication _run] + 840
34 UIKit 0x011e4f9b UIApplicationMain + 1225
35 Anchor-It 0x00005dbd main + 141
36 libdyld.dylib 0x03f5e701 start + 1
37 ??? 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Look at this part of the stack trace:
3 Foundation 0x021e4d9e -[NSObject(NSKeyValueCoding) setValue:forUndefinedKey:] + 282
4 Foundation 0x021511d7 _NSSetUsingKeyValueSetter + 88
5 Foundation 0x02150731 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 267
6 Foundation 0x021b2b0a -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 412
7 UIKit 0x0149b1f4 -[UIRuntimeOutletConnection connect] + 106
You've got a bad connection in your .xib or storyboard file. The view loading process is trying to connect something to some outlet that doesn't exist, resulting in an exception being thrown. Further information about exactly what connection is bad comes from the exception itself:
[<MapViewController 0xa964410> setValue:forUndefinedKey:]: this class is not key
value coding-compliant for the key titleText.'
So, you've got an instance of MapViewController, and UIRuntimeOutletConnection (part of the view loading system) is trying to set an outlet called titleText. MapViewController apparently doesn't have a titleText property. This could happen because you used to have such a property but deleted it, or because you changed the class of the view controller from something else (that had such a property) to MapViewController (which doesn't), etc.
Related
This question already has answers here:
Xcode - How to fix 'NSUnknownKeyException', reason: … this class is not key value coding-compliant for the key X" error?
(79 answers)
Closed 6 years ago.
I'm new to Swift and am experimenting with things such as the stepper. I followed online step-by-step instructions on how to make one but I'm getting an error (Attached below) and I am not quite understanding where the issue is.
Error:
2016-06-04 04:31:15.832 numChsnger[12025:1111078] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<numChsnger.ViewController 0x7fc082695990> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key stepper.'
*** First throw call stack:
(
0 CoreFoundation 0x0000000102328d85 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x00000001040ccdeb objc_exception_throw + 48
2 CoreFoundation 0x00000001023289c9 -[NSException raise] + 9
3 Foundation 0x00000001026fa19b -[NSObject(NSKeyValueCoding) setValue:forKey:] + 288
4 UIKit 0x0000000102ce3d0c -[UIViewController setValue:forKey:] + 88
5 UIKit 0x0000000102f1a7fb -[UIRuntimeOutletConnection connect] + 109
6 CoreFoundation 0x0000000102262890 -[NSArray makeObjectsPerformSelector:] + 224
7 UIKit 0x0000000102f191de -[UINib instantiateWithOwner:options:] + 1864
8 UIKit 0x0000000102cea8d6 -[UIViewController _loadViewFromNibNamed:bundle:] + 381
9 UIKit 0x0000000102ceb202 -[UIViewController loadView] + 178
10 UIKit 0x0000000102ceb560 -[UIViewController loadViewIfRequired] + 138
11 UIKit 0x0000000102cebcd3 -[UIViewController view] + 27
12 UIKit 0x0000000102bc1fb4 -[UIWindow addRootViewControllerViewIfPossible] + 61
13 UIKit 0x0000000102bc269d -[UIWindow _setHidden:forced:] + 282
14 UIKit 0x0000000102bd4180 -[UIWindow makeKeyAndVisible] + 42
15 UIKit 0x0000000102b48ed9 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4131
16 UIKit 0x0000000102b4f568 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1769
17 UIKit 0x0000000102b4c714 -[UIApplication workspaceDidEndTransaction:] + 188
18 FrontBoardServices 0x0000000105f5d8c8 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
19 FrontBoardServices 0x0000000105f5d741 -[FBSSerialQueue _performNext] + 178
20 FrontBoardServices 0x0000000105f5daca -[FBSSerialQueue _performNextFromRunLoopSource] + 45
21 CoreFoundation 0x000000010224e301 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
22 CoreFoundation 0x000000010224422c __CFRunLoopDoSources0 + 556
23 CoreFoundation 0x00000001022436e3 __CFRunLoopRun + 867
24 CoreFoundation 0x00000001022430f8 CFRunLoopRunSpecific + 488
25 UIKit 0x0000000102b4bf21 -[UIApplication _run] + 402
26 UIKit 0x0000000102b50f09 UIApplicationMain + 171
27 numChsnger 0x0000000102144382 main + 114
28 libdyld.dylib 0x0000000104b9092d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
View:
Check if your stepper has a redundant outlet in your storyboard. Right click on the stepper object in Storyboard and check if there is any outlet you don't want.
Also. Remove #Iboutlet var textV:UILabel! or reconnect it with the Label in your storyboard and the error will be gone.
This question already has answers here:
Xcode - How to fix 'NSUnknownKeyException', reason: … this class is not key value coding-compliant for the key X" error?
(79 answers)
Closed 7 years ago.
When I run my app, it produces the Thread 1: signal SIGBART error message with the detail below:
TappingGame[767:9324] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<ViewController 0x7fe5d0f12130> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key tapButton.'
*** First throw call stack:
(
0 CoreFoundation 0x000000010b07ee65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010aaf7deb objc_exception_throw + 48
2 CoreFoundation 0x000000010b07eaa9 -[NSException raise] + 9
3 Foundation 0x000000010a6c49bb -[NSObject(NSKeyValueCoding) setValue:forKey:] + 288
4 UIKit 0x000000010b5ba320 -[UIViewController setValue:forKey:] + 88
5 UIKit 0x000000010b7e8f41 -[UIRuntimeOutletConnection connect] + 109
6 CoreFoundation 0x000000010afbf4a0 -[NSArray makeObjectsPerformSelector:] + 224
7 UIKit 0x000000010b7e7924 -[UINib instantiateWithOwner:options:] + 1864
8 UIKit 0x000000010b5c0eea -[UIViewController _loadViewFromNibNamed:bundle:] + 381
9 UIKit 0x000000010b5c1816 -[UIViewController loadView] + 178
10 UIKit 0x000000010b5c1b74 -[UIViewController loadViewIfRequired] + 138
11 UIKit 0x000000010b5c22e7 -[UIViewController view] + 27
12 UIKit 0x000000010b498ab0 -[UIWindow addRootViewControllerViewIfPossible] + 61
13 UIKit 0x000000010b499199 -[UIWindow _setHidden:forced:] + 282
14 UIKit 0x000000010b4aac2e -[UIWindow makeKeyAndVisible] + 42
15 UIKit 0x000000010b423663 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4131
16 UIKit 0x000000010b429cc6 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1760
17 UIKit 0x000000010b426e7b -[UIApplication workspaceDidEndTransaction:] + 188
18 FrontBoardServices 0x000000010ddf7754 -[FBSSerialQueue _performNext] + 192
19 FrontBoardServices 0x000000010ddf7ac2 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
20 CoreFoundation 0x000000010afaaa31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
21 CoreFoundation 0x000000010afa095c __CFRunLoopDoSources0 + 556
22 CoreFoundation 0x000000010af9fe13 __CFRunLoopRun + 867
23 CoreFoundation 0x000000010af9f828 CFRunLoopRunSpecific + 488
24 UIKit 0x000000010b4267cd -[UIApplication _run] + 402
25 UIKit 0x000000010b42b610 UIApplicationMain + 171
26 TappingGame 0x000000010a5f89ef main + 111
27 libdyld.dylib 0x000000010d7ba92d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
I have looked at other questions asked but none of these solutions work. Does anyone have any idea from the errors listed as to why it isn't working?
Thanks
The problem described in your error is due to a incorrect linked class in your storyboard or nib.
You have an incorrect link. Probably you delete or changed name.
Check if your IBOutlet are correct link as image:
and remove invalid links.
This question already has answers here:
Xcode - How to fix 'NSUnknownKeyException', reason: … this class is not key value coding-compliant for the key X" error?
(79 answers)
Closed 7 years ago.
Everytime I create an outlet for a UITextField it breaks my app. No build errors just termination at boot.
"2015-11-27 17:34:19.005 ticTacToe[3540:71629] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<ViewController 0x7fbb82682450> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key wins.'
*** First throw call stack:
(
0 CoreFoundation 0x000000010d8b0c65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010c003bb7 objc_exception_throw + 45
2 CoreFoundation 0x000000010d8b08a9 -[NSException raise] + 9
3 Foundation 0x000000010bb99b53 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 259
4 CoreFoundation 0x000000010d7f8d50 -[NSArray makeObjectsPerformSelector:] + 224
5 UIKit 0x000000010c51d4eb -[UINib instantiateWithOwner:options:] + 1506
6 UIKit 0x000000010c3756d8 -[UIViewController _loadViewFromNibNamed:bundle:] + 242
7 UIKit 0x000000010c375cc8 -[UIViewController loadView] + 109
8 UIKit 0x000000010c375f39 -[UIViewController loadViewIfRequired] + 75
9 UIKit 0x000000010c3763ce -[UIViewController view] + 27
10 UIKit 0x000000010c291289 -[UIWindow addRootViewControllerViewIfPossible] + 58
11 UIKit 0x000000010c29164f -[UIWindow _setHidden:forced:] + 247
12 UIKit 0x000000010c29dde1 -[UIWindow makeKeyAndVisible] + 42
13 UIKit 0x000000010c241417 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2732
14 UIKit 0x000000010c24419e -[UIApplication _runWithMainScene:transitionContext:completion:] + 1349
15 UIKit 0x000000010c243095 -[UIApplication workspaceDidEndTransaction:] + 179
16 FrontBoardServices 0x0000000111bc95e5 __31-[FBSSerialQueue performAsync:]_block_invoke_2 + 21
17 CoreFoundation 0x000000010d7e441c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
18 CoreFoundation 0x000000010d7da165 __CFRunLoopDoBlocks + 341
19 CoreFoundation 0x000000010d7d9f25 __CFRunLoopRun + 2389
20 CoreFoundation 0x000000010d7d9366 CFRunLoopRunSpecific + 470
21 UIKit 0x000000010c242b02 -[UIApplication _run] + 413
22 UIKit 0x000000010c2458c0 UIApplicationMain + 1282
23 ticTacToe 0x000000010b6f386f main + 111
24 libdyld.dylib 0x000000010eaac145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException"
If possible please explain fix visually as I am programming retarded :-)
Further to Hayden's answer - you can easily check to see if any IBOutlets which you think should be connected to your View Controller are actually not connected by looking at the margin in Xcode (as below). Each IBOutlet will display a filled in circle showing you that it's connected to an element on the storyboard.
If the circle is empty it's not connected which can cause a crash...
I have been playing around with a project of mine tonight and now I can't get it to load up. Strange thing is I have got an older version of this and have even tried to copy all data across and still not loading.
Error I am getting in NSLog is as follows:
2014-04-01 01:24:53.513 Adult Game[47180:a0b] CUICatalog: Invalid asset name supplied: , or invalid scale factor: 2.000000
2014-04-01 01:24:53.515 Adult Game[47180:a0b] Could not load the "" image referenced from a nib in the bundle with identifier "DannyLinton.Adult-Game"
2014-04-01 01:24:53.519 Adult Game[47180:a0b] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<ViewController 0x8e35860> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key animate.'
*** First throw call stack:
(
0 CoreFoundation 0x0196f5e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x016f28b6 objc_exception_throw + 44
2 CoreFoundation 0x019ff6a1 -[NSException raise] + 17
3 Foundation 0x013b39ee -[NSObject(NSKeyValueCoding) setValue:forUndefinedKey:] + 282
4 Foundation 0x0131fcfb _NSSetUsingKeyValueSetter + 88
5 Foundation 0x0131f253 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 267
6 Foundation 0x0138170a -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 412
7 UIKit 0x00702a15 -[UIRuntimeOutletConnection connect] + 106
8 libobjc.A.dylib 0x017047d2 -[NSObject performSelector:] + 62
9 CoreFoundation 0x0196ab6a -[NSArray makeObjectsPerformSelector:] + 314
10 UIKit 0x0070156e -[UINib instantiateWithOwner:options:] + 1417
11 UIKit 0x00573605 -[UIViewController _loadViewFromNibNamed:bundle:] + 280
12 UIKit 0x00573dad -[UIViewController loadView] + 302
13 UIKit 0x005740ae -[UIViewController loadViewIfRequired] + 78
14 UIKit 0x005745b4 -[UIViewController view] + 35
15 UIKit 0x0049c9fd -[UIWindow addRootViewControllerViewIfPossible] + 66
16 UIKit 0x0049cd97 -[UIWindow _setHidden:forced:] + 312
17 UIKit 0x0049d02d -[UIWindow _orderFrontWithoutMakingKey] + 49
18 UIKit 0x004a789a -[UIWindow makeKeyAndVisible] + 65
19 UIKit 0x0045acd0 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1851
20 UIKit 0x0045f3a8 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 824
21 UIKit 0x0047387c -[UIApplication handleEvent:withNewEvent:] + 3447
22 UIKit 0x00473de9 -[UIApplication sendEvent:] + 85
23 UIKit 0x00461025 _UIApplicationHandleEvent + 736
24 GraphicsServices 0x031042f6 _PurpleEventCallback + 776
25 GraphicsServices 0x03103e01 PurpleEventCallback + 46
26 CoreFoundation 0x018ead65 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
27 CoreFoundation 0x018eaa9b __CFRunLoopDoSource1 + 523
28 CoreFoundation 0x0191577c __CFRunLoopRun + 2156
29 CoreFoundation 0x01914ac3 CFRunLoopRunSpecific + 467
30 CoreFoundation 0x019148db CFRunLoopRunInMode + 123
31 UIKit 0x0045eadd -[UIApplication _run] + 840
32 UIKit 0x00460d3b UIApplicationMain + 1225
33 Adult Game 0x00007dad main + 141
34 libdyld.dylib 0x02df2725 start + 0
35 ??? 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Any help would be very much appreciated.
You have a phantom connection in your StoryBoard or XIB file called "animate".
Open your StoryBoard / XIB file
If you are using a StoryBoard, select the AdultGame view controller
Click on the "File's Owner" along the left
Select "View > Utilities > Show Connections Inspector"
You will see a list of "Outlets". One of them will be called "animate" and have an exclamation point next to it. Click on the little "x" to delete it.
I want to display static cells in a ContainerView but every time the app runs it crashes at start. I read somewhere your unable to use static cells in UITableView but said it should work in a Container View to UITableViewController. Thanks for any input.
2014-01-01 15:44:56.294 InterestingGame[24199:a0b] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<ViewController 0x8935970> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key second.'
*** First throw call stack:
(
0 CoreFoundation 0x0173d5e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x014c08b6 objc_exception_throw + 44
2 CoreFoundation 0x017cd6a1 -[NSException raise] + 17
3 Foundation 0x011819ee -[NSObject(NSKeyValueCoding) setValue:forUndefinedKey:] + 282
4 Foundation 0x010edcfb _NSSetUsingKeyValueSetter + 88
5 Foundation 0x010ed253 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 267
6 Foundation 0x0114f70a -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 412
7 UIKit 0x004d0a15 -[UIRuntimeOutletConnection connect] + 106
8 libobjc.A.dylib 0x014d27d2 -[NSObject performSelector:] + 62
9 CoreFoundation 0x01738b6a -[NSArray makeObjectsPerformSelector:] + 314
10 UIKit 0x004cf56e -[UINib instantiateWithOwner:options:] + 1417
11 UIKit 0x00762a2f -[UIStoryboard instantiateViewControllerWithIdentifier:] + 220
12 UIKit 0x00762ba8 -[UIStoryboard instantiateInitialViewController] + 74
13 UIKit 0x0022e44c -[UIApplication _loadMainStoryboardFileNamed:bundle:] + 79
14 UIKit 0x0022e6e9 -[UIApplication _loadMainInterfaceFile] + 245
15 UIKit 0x0022d28f -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 543
16 UIKit 0x0024187c -[UIApplication handleEvent:withNewEvent:] + 3447
17 UIKit 0x00241de9 -[UIApplication sendEvent:] + 85
18 UIKit 0x0022f025 _UIApplicationHandleEvent + 736
19 GraphicsServices 0x036942f6 _PurpleEventCallback + 776
20 GraphicsServices 0x03693e01 PurpleEventCallback + 46
21 CoreFoundation 0x016b8d65 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
22 CoreFoundation 0x016b8a9b __CFRunLoopDoSource1 + 523
23 CoreFoundation 0x016e377c __CFRunLoopRun + 2156
24 CoreFoundation 0x016e2ac3 CFRunLoopRunSpecific + 467
25 CoreFoundation 0x016e28db CFRunLoopRunInMode + 123
26 UIKit 0x0022cadd -[UIApplication _run] + 840
27 UIKit 0x0022ed3b UIApplicationMain + 1225
28 InterestingGame 0x0000473d main + 141
29 libdyld.dylib 0x01d79725 start + 0
)
libc++abi.dylib: terminating with uncaught exception of type NSException
That exception is pointing to an outlet being hooked up in interface builder that may no longer have an underlying property.
You may have previously had a second property declared in code that was then hooked up in a xib/storyboard. You will then have removed this property or renamed it and not broken the connection in the xib/storyboard. You need to go to the connections panel in interface builder and remove the broken connection