{"id":4234,"date":"2014-03-30T09:25:01","date_gmt":"2014-03-30T09:25:01","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/linking-label-to-iboutlet-gives-nsunknownkeyexception-collection-of-common-programming-errors\/"},"modified":"2014-03-30T09:25:01","modified_gmt":"2014-03-30T09:25:01","slug":"linking-label-to-iboutlet-gives-nsunknownkeyexception-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/linking-label-to-iboutlet-gives-nsunknownkeyexception-collection-of-common-programming-errors\/","title":{"rendered":"Linking Label to IBOutlet gives NSUnknownKeyException-Collection of common programming errors"},"content":{"rendered":"<p>I have created a TabBarView. On one of the tabs, I have a View with several <code>Labels<\/code> on it. It works fine.<\/p>\n<p>When I connect the Labels in Interface Builder to the File&#8217;s Owner (the corresponding IBOutlets) then the App crashes with the following error when I open that tab:<\/p>\n<pre><code>2011-05-15 18:36:29.070 AeroNav[958:707] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key speedLabel.'\n*** Call stack at first throw:\n(\n0   CoreFoundation                      0x312a664f __exceptionPreprocess + 114\n1   libobjc.A.dylib                     0x34a07c5d objc_exception_throw + 24\n2   CoreFoundation                      0x312a63cd -[NSException dealloc] + 0\n3   Foundation                          0x351c7edb -[NSObject(NSKeyValueCoding) setValue:forUndefinedKey:] + 182\n4   Foundation                          0x351809cb _NSSetUsingKeyValueSetter + 90\n5   Foundation                          0x35180217 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 194\n6   Foundation                          0x3516242f -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 130\n7   UIKit                               0x369848df -[UIRuntimeOutletConnection connect] + 66\n8   CoreFoundation                      0x3123ed7b -[NSObject(NSObject) performSelector:] + 18\n9   CoreFoundation                      0x3123e99d -[NSArray makeObjectsPerformSelector:] + 388\n10  UIKit                               0x36983847 -[UINib instantiateWithOwner:options:] + 586\n11  UIKit                               0x36984e09 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 92\n12  UIKit                               0x368fe5e9 -[UIViewController _loadViewFromNibNamed:bundle:] + 36\n13  UIKit                               0x368cbfa5 -[UIViewController loadView] + 80\n14  UIKit                               0x367b0ebf -[UIViewController view] + 30\n15  UIKit                               0x367ee1db -[UITabBarController transitionFromViewController:toViewController:transition:shouldSetSelected:] + 66\n16  UIKit                               0x367ee18d -[UITabBarController transitionFromViewController:toViewController:] + 32\n17  UIKit                               0x367eda33 -[UITabBarController _setSelectedViewController:] + 186\n18  UIKit                               0x36872ceb -[UITabBarController setSelectedViewController:] + 14\n19  UIKit                               0x36872be7 -[UITabBarController _tabBarItemClicked:] + 226\n20  CoreFoundation                      0x31216571 -[NSObject(NSObject) performSelector:withObject:withObject:] + 24\n21  UIKit                               0x36796ec9 -[UIApplication sendAction:to:from:forEvent:] + 84\n22  UIKit                               0x36796e69 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 32\n23  UIKit                               0x36872a8b -[UITabBar _sendAction:withEvent:] + 270\n24  CoreFoundation                      0x31216571 -[NSObject(NSObject) performSelector:withObject:withObject:] + 24\n25  UIKit                               0x36796ec9 -[UIApplication sendAction:to:from:forEvent:] + 84\n26  UIKit                               0x36796e69 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 32\n27  UIKit                               0x36796e3b -[UIControl sendAction:to:forEvent:] + 38\n28  UIKit                               0x36796b8d -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 356\n29  UIKit                               0x367d0bd9 -[UIControl sendActionsForControlEvents:] + 16\n30  UIKit                               0x36872815 -[UITabBar(Static) _buttonUp:] + 80\n31  CoreFoundation                      0x31216571 -[NSObject(NSObject) performSelector:withObject:withObject:] + 24\n32  UIKit                               0x36796ec9 -[UIApplication sendAction:to:from:forEvent:] + 84\n33  UIKit                               0x36796e69 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 32\n34  UIKit                               0x36796e3b -[UIControl sendAction:to:forEvent:] + 38\n35  UIKit                               0x36796b8d -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 356\n36  UIKit                               0x36797423 -[UIControl touchesEnded:withEvent:] + 342\n37  UIKit                               0x36795bf5 -[UIWindow _sendTouchesForEvent:] + 368\n38  UIKit                               0x3679556f -[UIWindow sendEvent:] + 262\n39  UIKit                               0x3677e313 -[UIApplication sendEvent:] + 298\n40  UIKit                               0x3677dc53 _UIApplicationHandleEvent + 5090\n41  GraphicsServices                    0x36452e77 PurpleEventCallback + 666\n42  CoreFoundation                      0x3127da97 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 26\n43  CoreFoundation                      0x3127f83f __CFRunLoopDoSource1 + 166\n44  CoreFoundation                      0x3128060d __CFRunLoopRun + 520\n45  CoreFoundation                      0x31210ec3 CFRunLoopRunSpecific + 230\n46  CoreFoundation                      0x31210dcb CFRunLoopRunInMode + 58\n47  GraphicsServices                    0x3645241f GSEventRunModal + 114\n48  GraphicsServices                    0x364524cb GSEventRun + 62\n49  UIKit                               0x367a8d69 -[UIApplication _run] + 404\n50  UIKit                               0x367a6807 UIApplicationMain + 670\n51  AeroNav                             0x00002423 main + 70\n52  AeroNav                             0x000023d8 start + 40\n)\nterminate called after throwing an instance of 'NSException'\n<\/code><\/pre>\n<p>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?<\/p>\n<p>This is how my header file looks:<\/p>\n<pre><code>\/\/Stats.h\n#import \n@interface Stats : UIViewController\n{\n    IBOutlet UILabel *speedLabel;\n    IBOutlet UILabel *headingLabel;\n}\n@end\n<\/code><\/pre>\n<p>If anybody has any tips or links to other similar posts, I would appreciate it!<\/p>\n<p>Thank you in advance!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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&#8217;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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4234","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4234","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=4234"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4234\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4234"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4234"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4234"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}