I have created a TabBarView. On one of the tabs, I have a View with several Labels on it. It works fine.
When I connect the Labels in Interface Builder to the File's Owner (the corresponding IBOutlets) then the App crashes with the following error when I open that tab:
2011-05-15 18:36:29.070 AeroNav[958:707] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x18afe0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key speedLabel.'
*** Call stack at first throw:
(
0 CoreFoundation 0x312a664f __exceptionPreprocess + 114
1 libobjc.A.dylib 0x34a07c5d objc_exception_throw + 24
2 CoreFoundation 0x312a63cd -[NSException dealloc] + 0
3 Foundation 0x351c7edb -[NSObject(NSKeyValueCoding) setValue:forUndefinedKey:] + 182
4 Foundation 0x351809cb _NSSetUsingKeyValueSetter + 90
5 Foundation 0x35180217 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 194
6 Foundation 0x3516242f -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 130
7 UIKit 0x369848df -[UIRuntimeOutletConnection connect] + 66
8 CoreFoundation 0x3123ed7b -[NSObject(NSObject) performSelector:] + 18
9 CoreFoundation 0x3123e99d -[NSArray makeObjectsPerformSelector:] + 388
10 UIKit 0x36983847 -[UINib instantiateWithOwner:options:] + 586
11 UIKit 0x36984e09 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 92
12 UIKit 0x368fe5e9 -[UIViewController _loadViewFromNibNamed:bundle:] + 36
13 UIKit 0x368cbfa5 -[UIViewController loadView] + 80
14 UIKit 0x367b0ebf -[UIViewController view] + 30
15 UIKit 0x367ee1db -[UITabBarController transitionFromViewController:toViewController:transition:shouldSetSelected:] + 66
16 UIKit 0x367ee18d -[UITabBarController transitionFromViewController:toViewController:] + 32
17 UIKit 0x367eda33 -[UITabBarController _setSelectedViewController:] + 186
18 UIKit 0x36872ceb -[UITabBarController setSelectedViewController:] + 14
19 UIKit 0x36872be7 -[UITabBarController _tabBarItemClicked:] + 226
20 CoreFoundation 0x31216571 -[NSObject(NSObject) performSelector:withObject:withObject:] + 24
21 UIKit 0x36796ec9 -[UIApplication sendAction:to:from:forEvent:] + 84
22 UIKit 0x36796e69 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 32
23 UIKit 0x36872a8b -[UITabBar _sendAction:withEvent:] + 270
24 CoreFoundation 0x31216571 -[NSObject(NSObject) performSelector:withObject:withObject:] + 24
25 UIKit 0x36796ec9 -[UIApplication sendAction:to:from:forEvent:] + 84
26 UIKit 0x36796e69 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 32
27 UIKit 0x36796e3b -[UIControl sendAction:to:forEvent:] + 38
28 UIKit 0x36796b8d -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 356
29 UIKit 0x367d0bd9 -[UIControl sendActionsForControlEvents:] + 16
30 UIKit 0x36872815 -[UITabBar(Static) _buttonUp:] + 80
31 CoreFoundation 0x31216571 -[NSObject(NSObject) performSelector:withObject:withObject:] + 24
32 UIKit 0x36796ec9 -[UIApplication sendAction:to:from:forEvent:] + 84
33 UIKit 0x36796e69 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 32
34 UIKit 0x36796e3b -[UIControl sendAction:to:forEvent:] + 38
35 UIKit 0x36796b8d -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 356
36 UIKit 0x36797423 -[UIControl touchesEnded:withEvent:] + 342
37 UIKit 0x36795bf5 -[UIWindow _sendTouchesForEvent:] + 368
38 UIKit 0x3679556f -[UIWindow sendEvent:] + 262
39 UIKit 0x3677e313 -[UIApplication sendEvent:] + 298
40 UIKit 0x3677dc53 _UIApplicationHandleEvent + 5090
41 GraphicsServices 0x36452e77 PurpleEventCallback + 666
42 CoreFoundation 0x3127da97 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 26
43 CoreFoundation 0x3127f83f __CFRunLoopDoSource1 + 166
44 CoreFoundation 0x3128060d __CFRunLoopRun + 520
45 CoreFoundation 0x31210ec3 CFRunLoopRunSpecific + 230
46 CoreFoundation 0x31210dcb CFRunLoopRunInMode + 58
47 GraphicsServices 0x3645241f GSEventRunModal + 114
48 GraphicsServices 0x364524cb GSEventRun + 62
49 UIKit 0x367a8d69 -[UIApplication _run] + 404
50 UIKit 0x367a6807 UIApplicationMain + 670
51 AeroNav 0x00002423 main + 70
52 AeroNav 0x000023d8 start + 40
)
terminate called after throwing an instance of 'NSException'
I have read that it can be related to the xib not matching (correctly connected) to its view controller. I have no idea how to check or fix that?
This is how my header file looks:
//Stats.h
#import <UIKit/UIKit.h>
#interface Stats : UIViewController
{
IBOutlet UILabel *speedLabel;
IBOutlet UILabel *headingLabel;
}
#end
If anybody has any tips or links to other similar posts, I would appreciate it!
Thank you in advance!
Related
2017-04-13 12:16:36.606 Boardmeeting[4601:1375127] Uncaught exception [<UIViewController 0x7f988fe32750> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key btnAvatar.
2017-04-13 12:16:36.611 Boardmeeting[4601:1375127] Stack trace: (
0 CoreFoundation 0x000000010f555d4b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010efbe21e objc_exception_throw + 48
2 CoreFoundation 0x000000010f555c99 -[NSException raise] + 9
3 Foundation 0x000000010d25e9df -[NSObject(NSKeyValueCoding) setValue:forKey:] + 291
4 UIKit 0x000000010d90d293 -[UIViewController setValue:forKey:] + 88
5 UIKit 0x000000010db8179e -[UIRuntimeOutletConnection connect] + 109
6 CoreFoundation 0x000000010f4fa9e0 -[NSArray makeObjectsPerformSelector:] + 256
7 UIKit 0x000000010db80122 -[UINib instantiateWithOwner:options:] + 1867
8 UIKit 0x000000010d9139c5 -[UIViewController _loadViewFromNibNamed:bundle:] + 386
9 UIKit 0x000000010d9142e7 -[UIViewController loadView] + 177
10 UIKit 0x000000010d91461c -[UIViewController loadViewIfRequired] + 201
11 UIKit 0x000000010d914e70 -[UIViewController view] + 27
12 UIKit 0x000000010d9734f3 -[UITabBarController transitionFromViewController:toViewController:transition:shouldSetSelected:] + 483
13 UIKit 0x000000010d972935 -[UITabBarController transitionFromViewController:toViewController:] + 59
14 UIKit 0x000000010d96e7f6 -[UITabBarController _setSelectedViewController:] + 365
15 UIKit 0x000000010d96e57b -[UITabBarController setSelectedIndex:] + 131
16 Boardmeeting 0x0000000109746bce -[LoginViewController prepareForSegue:sender:] + 350
17 UIKit 0x000000010df4817f -[UIStoryboardSegueTemplate _performWithDestinationViewController:sender:] + 353
18 UIKit 0x000000010df47fed -[UIStoryboardSegueTemplate _perform:] + 82
19 UIKit 0x000000010d917a1f -[UIViewController performSegueWithIdentifier:sender:] + 99
20 Boardmeeting 0x00000001097470ee -[LoginViewController requestFinished:] + 446
21 Boardmeeting 0x00000001096fbe9e -[ASIHTTPRequest reportFinished] + 142
22 Foundation 0x000000010d27ee9e __NSThreadPerformPerform + 326
23 CoreFoundation 0x000000010f4fa761 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
24 CoreFoundation 0x000000010f4df98c __CFRunLoopDoSources0 + 556
25 CoreFoundation 0x000000010f4dee76 __CFRunLoopRun + 918
26 CoreFoundation 0x000000010f4de884 CFRunLoopRunSpecific + 420
27 GraphicsServices 0x0000000115158a6f GSEventRunModal + 161
28 UIKit 0x000000010d772c68 UIApplicationMain + 159
29 Boardmeeting 0x0000000109758eae main + 142
30 libdyld.dylib 0x000000011067b68d start + 1
)
This usually happens when you remove an IBOutlet from a class, but you don't remove the outlet link in the storyboard.
In your case it's btnAvatar: could you have removed this from your class/controller but you left it there on the storyboard?
I've been stuck on this all day, and struggling to identify the source of a NSRangeException crash.
The app builds fine, but in the process of loading the first scene it throws:
2015-05-01 17:21:48.606 AppName[3707:447852] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 4 beyond bounds [0 .. 3]'
The full stack trace is:
*** First throw call stack:
(
0 CoreFoundation 0x0000000111d22c65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000111584bb7 objc_exception_throw + 45
2 CoreFoundation 0x0000000111c0c093 -[__NSArrayM objectAtIndex:] + 227
3 UIKit 0x000000010f311881 _UIViewTopDownSubtreeTraversal + 193
4 UIKit 0x000000010f932fa3 -[UIView(UIConstraintBasedLayout_EngineDelegate) _invalidateSystemLayoutSizeFittingSizeAtEngineDelegateLevel] + 141
5 Foundation 0x000000010e931d6f -[NSISEngine tryToAddConstraintWithMarker:expression:integralizationAdjustment:mutuallyExclusiveConstraints:] + 915
6 Foundation 0x000000010eabc1e8 -[NSLayoutConstraint _addLoweredExpression:toEngine:integralizationAdjustment:lastLoweredConstantWasRounded:mutuallyExclusiveConstraints:] + 275
7 Foundation 0x000000010e92649a -[NSLayoutConstraint _addToEngine:integralizationAdjustment:mutuallyExclusiveConstraints:] + 220
8 UIKit 0x000000010f92fa34 __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke_2 + 474
9 Foundation 0x000000010e9341be -[NSISEngine withBehaviors:performModifications:] + 155
10 UIKit 0x000000010f92f83a __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke + 452
11 UIKit 0x000000010f92f64d -[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:] + 197
12 UIKit 0x000000010f92f933 __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke_2 + 217
13 Foundation 0x000000010e9341be -[NSISEngine withBehaviors:performModifications:] + 155
14 UIKit 0x000000010f92f83a __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke + 452
15 UIKit 0x000000010f92f64d -[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:] + 197
16 UIKit 0x000000010f92f2de -[UIView(AdditionalLayoutSupport) _initializeHostedLayoutEngine] + 404
17 UIKit 0x000000010f92426e -[UIView(UIConstraintBasedLayout) _layoutEngine_windowDidChange] + 126
18 UIKit 0x000000010f32f561 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 209
19 UIKit 0x000000010f32f74a -[UIView(Internal) _didMoveFromWindow:toWindow:] + 698
20 UIKit 0x000000010f327ecf __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 125
21 UIKit 0x000000010f327e43 -[UIView(Hierarchy) _postMovedFromSuperview:] + 437
22 UIKit 0x000000010f331f48 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1660
23 UIKit 0x000000010f61884c -[UINavigationTransitionView transition:fromView:toView:] + 479
24 UIKit 0x000000010f4161b0 -[UINavigationController _startTransition:fromViewController:toViewController:] + 2984
25 UIKit 0x000000010f416448 -[UINavigationController _startDeferredTransitionIfNeeded:] + 523
26 UIKit 0x000000010f416f0e -[UINavigationController __viewWillLayoutSubviews] + 43
27 UIKit 0x000000010f561715 -[UILayoutContainerView layoutSubviews] + 202
28 UIKit 0x000000010f334a2b -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 536
29 QuartzCore 0x000000010eff4ec2 -[CALayer layoutSublayers] + 146
30 QuartzCore 0x000000010efe96d6 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
31 QuartzCore 0x000000010efe9546 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
32 QuartzCore 0x000000010ef55886 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 242
33 QuartzCore 0x000000010ef56a3a _ZN2CA11Transaction6commitEv + 462
34 UIKit 0x000000010f2b2a2d -[UIApplication _reportMainSceneUpdateFinished:] + 44
35 UIKit 0x000000010f2b36f1 -[UIApplication _runWithMainScene:transitionContext:completion:] + 2648
36 UIKit 0x000000010f2b20d5 -[UIApplication workspaceDidEndTransaction:] + 179
37 FrontBoardServices 0x00000001158955e5 __31-[FBSSerialQueue performAsync:]_block_invoke_2 + 21
38 CoreFoundation 0x0000000111c5641c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
39 CoreFoundation 0x0000000111c4c165 __CFRunLoopDoBlocks + 341
40 CoreFoundation 0x0000000111c4b923 __CFRunLoopRun + 851
41 CoreFoundation 0x0000000111c4b366 CFRunLoopRunSpecific + 470
42 UIKit 0x000000010f2b1b42 -[UIApplication _run] + 413
43 UIKit 0x000000010f2b4900 UIApplicationMain + 1282
44 My360 0x000000010dcf26ff main + 111
45 libdyld.dylib 0x00000001127f5145 start + 1
46 ??? 0x0000000000000001 0x0 + 1
)
It's a large app, and I cannot identify which objectAtIndex is causing the issue.
After looking at similar issues, I added an Exception breakpoint:
However the breakpoint just keeps taking me back to the main.m file:
int main(int argc, char * argv[]) {
#autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
Can anyone point me towards how I can identify the line that is causing this exception?
Thanks!
Edit:
When I click on the My360 icon at the top of the debugging console, it shows this:
I suspect some code is trying to use my FooterArchiveView similar to a NSDictionary so I tried using breakpoints to find the bottleneck but my breakpoints are sending me on a wild goose chase into system files like UINibDecoderDecodeObjectForValue. What should I do?
2012-03-08 08:35:55.417 JOM App[44161:207] Uncaught exception: [<FooterArchiveView 0x9b27770> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key featured.
2012-03-08 08:35:55.420 JOM App[44161:207] Stack trace: (
0 CoreFoundation 0x0169c06e __exceptionPreprocess + 206
1 libobjc.A.dylib 0x01c50d0a objc_exception_throw + 44
2 CoreFoundation 0x0169bf11 -[NSException raise] + 17
3 Foundation 0x00f89032 -[NSObject(NSKeyValueCoding) setValue:forUndefinedKey:] + 282
4 Foundation 0x00efaf7b _NSSetUsingKeyValueSetter + 136
5 Foundation 0x00efaeeb -[NSObject(NSKeyValueCoding) setValue:forKey:] + 287
6 UIKit 0x00628268 -[UIView(CALayerDelegate) setValue:forKey:] + 168
7 Foundation 0x00f15d60 -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 393
8 UIKit 0x0080891a -[UIRuntimeOutletConnection connect] + 106
9 CoreFoundation 0x0169de1a -[NSObject performSelector:] + 58
10 CoreFoundation 0x01607821 -[NSArray makeObjectsPerformSelector:] + 273
11 UIKit 0x0080746e -[UINib instantiateWithOwner:options:] + 1178
12 UIKit 0x00809010 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 157
13 JOM App 0x0000e9ca -[ContentView setContent:] + 1258
14 JOM App 0x0000c906 -[NavigationView devotionsTUI:] + 390
15 CoreFoundation 0x0169dec9 -[NSObject performSelector:withObject:withObject:] + 73
16 UIKit 0x005ec5c2 -[UIApplication sendAction:to:from:forEvent:] + 96
17 UIKit 0x005ec55a -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
18 UIKit 0x00691b76 -[UIControl sendAction:to:forEvent:] + 66
19 UIKit 0x0069203f -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 503
20 UIKit 0x006912fe -[UIControl touchesEnded:withEvent:] + 549
21 UIKit 0x00611a30 -[UIWindow _sendTouchesForEvent:] + 513
22 UIKit 0x00611c56 -[UIWindow sendEvent:] + 273
23 UIKit 0x005f8384 -[UIApplication sendEvent:] + 464
24 UIKit 0x005ebaa9 _UIApplicationHandleEvent + 8196
25 GraphicsServices 0x02589fa9 PurpleEventCallback + 1274
26 CoreFoundation 0x016701c5 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
27 CoreFoundation 0x015d5022 __CFRunLoopDoSource1 + 146
28 CoreFoundation 0x015d390a __CFRunLoopRun + 2218
29 CoreFoundation 0x015d2db4 CFRunLoopRunSpecific + 212
30 CoreFoundation 0x015d2ccb CFRunLoopRunInMode + 123
31 GraphicsServices 0x02588879 GSEventRunModal + 207
32 GraphicsServices 0x0258893e GSEventRun + 114
33 UIKit 0x005e9a9b UIApplicationMain + 1175
34 JOM App 0x000027d2 main + 178
35 JOM App 0x00002715 start + 53
36 ??? 0x00000001 0x0 + 1
)
"This class is not key value coding-compliant for the key featured." means that a class is trying to set a property on an object through key-value coding, only to find that it cannot. This most often occurs when you've defined an outlet, connected it in a nib, then removed the outlet from your code, leaving a dangling connection in the nib. When the nib is deserialised, it tries to connect up the outlet using key-value coding and you see the error above.
This is a new one. I'm testing that my various viewcontrollers are getting loaded by my tab bar, so I put this on one of them:
- (void)viewDidLoad
{
[super viewDidLoad];
UILabel*yo=[[UILabel alloc] init];
self.testlabel=yo;
self.testlabel.text=[NSString stringWithFormat:#"sup"];
[yo release];
This is what I get when I click the tab button for that controller:
2011-07-26 14:05:37.773 Pickers[802:707] Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key testlabel.'*
What in the world?! I must be doing something exceptionally basic and wrong here. Can anyone spot it?
I've got this in the .h and .m:
#interface SingleVC : UIViewController
#property (nonatomic, retain) IBOutlet UILabel*testlabel;
#end
and
#implementation SingleVC
#synthesize testlabel;
I get the following stack errors (which I do not know how to read):
*** Call stack at first throw:
(
0 CoreFoundation 0x00dc25a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x00f16313 objc_exception_throw + 44
2 CoreFoundation 0x00dc24e1 -[NSException raise] + 17
3 Foundation 0x00794677 _NSSetUsingKeyValueSetter + 135
4 Foundation 0x007945e5 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 285
5 UIKit 0x0021030c -[UIRuntimeOutletConnection connect] + 112
6 CoreFoundation 0x00d388cf -[NSArray makeObjectsPerformSelector:] + 239
7 UIKit 0x0020ed23 -[UINib instantiateWithOwner:options:] + 1041
8 UIKit 0x00210ab7 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
9 UIKit 0x000c6628 -[UIViewController _loadViewFromNibNamed:bundle:] + 70
10 UIKit 0x000c4134 -[UIViewController loadView] + 120
11 UIKit 0x000c400e -[UIViewController view] + 56
12 UIKit 0x000d6f54 -[UITabBarController transitionFromViewController:toViewController:transition:shouldSetSelected:] + 120
13 UIKit 0x000d5aaa -[UITabBarController transitionFromViewController:toViewController:] + 64
14 UIKit 0x000d78a2 -[UITabBarController _setSelectedViewController:] + 263
15 UIKit 0x000d7711 -[UITabBarController _tabBarItemClicked:] + 352
16 UIKit 0x000144fd -[UIApplication sendAction:to:from:forEvent:] + 119
17 UIKit 0x00216ce6 -[UITabBar _sendAction:withEvent:] + 422
18 UIKit 0x000144fd -[UIApplication sendAction:to:from:forEvent:] + 119
19 UIKit 0x000a4799 -[UIControl sendAction:to:forEvent:] + 67
20 UIKit 0x000a6c2b -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
21 UIKit 0x000a4750 -[UIControl sendActionsForControlEvents:] + 49
22 UIKit 0x000144fd -[UIApplication sendAction:to:from:forEvent:] + 119
23 UIKit 0x000a4799 -[UIControl sendAction:to:forEvent:] + 67
24 UIKit 0x000a6c2b -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
25 UIKit 0x000a57d8 -[UIControl touchesEnded:withEvent:] + 458
26 UIKit 0x00038ded -[UIWindow _sendTouchesForEvent:] + 567
27 UIKit 0x00019c37 -[UIApplication sendEvent:] + 447
28 UIKit 0x0001ef2e _UIApplicationHandleEvent + 7576
29 GraphicsServices 0x00ffb992 PurpleEventCallback + 1550
30 CoreFoundation 0x00da3944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
31 CoreFoundation 0x00d03cf7 __CFRunLoopDoSource1 + 215
32 CoreFoundation 0x00d00f83 __CFRunLoopRun + 979
33 CoreFoundation 0x00d00840 CFRunLoopRunSpecific + 208
34 CoreFoundation 0x00d00761 CFRunLoopRunInMode + 97
35 GraphicsServices 0x00ffa1c4 GSEventRunModal + 217
36 GraphicsServices 0x00ffa289 GSEventRun + 115
37 UIKit 0x00022c93 UIApplicationMain + 1160
38 Pickers 0x000025c9 main + 121
39 Pickers 0x00002545 start + 53
)
terminate called throwing an exceptionCurrent language: auto; currently objective-c
kill
quit
So after some Googling on other sites, it turns out that quite a few people have had this exact same and basic problem. I found the solution here:
https://discussions.apple.com/thread/1598422?threadID=1598422
I was checking my classes within the individual nibs of each controller, but you must also set the classes in the tab controller as well, for each item (I had already set the nib name for each tab bar item, but not the class).
so, problem resolved and was, as expected, quite basic.
It's a stumper why the error created was for key value coding, though.
perhaps a connection in IB from some object that formerly had an IBOutlet called testlabel?
stop the debugger in ObjC Exceptions and post your stack trace if it's not obvious
Hey everyone, I'm creating a tab-view application, and in the one tab I have 7 textFields that I am trying to save the information for with a "Save" button. After making the connections between the objects in my controller.h file and the actual text fields, when I select the tab with all this stuff in it, the application crashes and goes to the springboard. I have the debug here:
2011-02-23 08:49:02.522 Tow Boat 911[19138:207] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x4e0d1d0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key colour.'
*** Call stack at first throw:
(
0 CoreFoundation 0x00ec6be9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x00cbb5c2 objc_exception_throw + 47
2 CoreFoundation 0x00ec6b21 -[NSException raise] + 17
3 Foundation 0x000286cf _NSSetUsingKeyValueSetter + 135
4 Foundation 0x0002863d -[NSObject(NSKeyValueCoding) setValue:forKey:] + 285
5 UIKit 0x004a78d6 -[UIRuntimeOutletConnection connect] + 112
6 CoreFoundation 0x00e3d2cf -[NSArray makeObjectsPerformSelector:] + 239
7 UIKit 0x004a62ed -[UINib instantiateWithOwner:options:] + 1041
8 UIKit 0x004a8081 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
9 UIKit 0x00360a94 -[UIViewController _loadViewFromNibNamed:bundle:] + 70
10 UIKit 0x0035e709 -[UIViewController loadView] + 120
11 UIKit 0x0035e5e3 -[UIViewController view] + 56
12 UIKit 0x00371230 -[UITabBarController transitionFromViewController:toViewController:transition:shouldSetSelected:] + 120
13 UIKit 0x0036fd86 -[UITabBarController transitionFromViewController:toViewController:] + 64
14 UIKit 0x00371b7e -[UITabBarController _setSelectedViewController:] + 263
15 UIKit 0x003719ed -[UITabBarController _tabBarItemClicked:] + 352
16 UIKit 0x002b0a6e -[UIApplication sendAction:to:from:forEvent:] + 119
17 UIKit 0x004ae1f2 -[UITabBar _sendAction:withEvent:] + 422
18 UIKit 0x002b0a6e -[UIApplication sendAction:to:from:forEvent:] + 119
19 UIKit 0x0033f1b5 -[UIControl sendAction:to:forEvent:] + 67
20 UIKit 0x00341647 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
21 UIKit 0x0033f16c -[UIControl sendActionsForControlEvents:] + 49
22 UIKit 0x002b0a6e -[UIApplication sendAction:to:from:forEvent:] + 119
23 UIKit 0x0033f1b5 -[UIControl sendAction:to:forEvent:] + 67
24 UIKit 0x00341647 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
25 UIKit 0x003401f4 -[UIControl touchesEnded:withEvent:] + 458
26 UIKit 0x002d50d1 -[UIWindow _sendTouchesForEvent:] + 567
27 UIKit 0x002b637a -[UIApplication sendEvent:] + 447
28 UIKit 0x002bb732 _UIApplicationHandleEvent + 7576
29 GraphicsServices 0x016dda36 PurpleEventCallback + 1550
30 CoreFoundation 0x00ea8064 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
31 CoreFoundation 0x00e086f7 __CFRunLoopDoSource1 + 215
32 CoreFoundation 0x00e05983 __CFRunLoopRun + 979
33 CoreFoundation 0x00e05240 CFRunLoopRunSpecific + 208
34 CoreFoundation 0x00e05161 CFRunLoopRunInMode + 97
35 GraphicsServices 0x016dc268 GSEventRunModal + 217
36 GraphicsServices 0x016dc32d GSEventRun + 115
37 UIKit 0x002bf42e UIApplicationMain + 1160
38 Tow Boat 911 0x00001df8 main + 102
39 Tow Boat 911 0x00001d89 start + 53
)
terminate called after throwing an instance of 'NSException'
Program received signal: “SIGABRT”.
Thanks everyone for any help in advance!
Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key colour.
In this case check the following:
Ensure that you have not misspelled the key you are trying to access i.e. colour.
The class attribute you are trying to access i.e. colour should be Key Value compliant. You can have the attribute declared as a property in header and synthesize the same in the implementation file. Do not change the default name for the getter and setter in the property declaration. The default method name/signature is KVC compliant.
Apple documentation on KVC covering the accessor method code: http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/KeyValueCoding/Articles/Overview.html
If you are using core data ensure that the property being accessed is present in the corresponding header file and also has its code in the implementation file. It can happen that you have added this property later to the model and have not updated the generated header and implementation file.
Came across this post without an answer so thought I would put a response which may help someone else.