将标签链接到IBOutlet会提供NSUnknownKeyException

我创build了一个TabBarView。 在其中的一个选项卡上,我有一个视图上有几个Labels 。 它工作正常。

当我将界面生成器中的标签连接到文件的所有者(相应的IBOutlets)时,当我打开该标签时,应用程序崩溃并出现以下错误:

 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' 

我已经读过,它可以与xib不匹配(正确连接)到其视图控制器有关。 我不知道如何检查或修复?

这是我的头文件的外观:

 //Stats.h #import <UIKit/UIKit.h> @interface Stats : UIViewController { IBOutlet UILabel *speedLabel; IBOutlet UILabel *headingLabel; } @end 

如果有人有任何提示或链接到其他类似的职位,我将不胜感激!

先谢谢你!