Iphone 不符合键值编码
我正在尝试将ViewController连接到TabController中的选项卡。我已经将选项卡类型设置为NavigationController,将ViewController子类设置为选项卡的标识。我还为选项卡设置了NIB名称。当我在NavigationContollers中使用任何其他选项卡时,一切都正常,但有一个特定视图引发了一个异常,该类不符合key TXT Password的键值编码 该属性在ViewController接口中声明为UINavigationViewController的子类,并作为属性公开。它也像其他控件一样在IB中合成和连接,但出于某种原因引发了这个异常Iphone 不符合键值编码,iphone,objective-c,ios,xcode,uinavigationcontroller,Iphone,Objective C,Ios,Xcode,Uinavigationcontroller,我正在尝试将ViewController连接到TabController中的选项卡。我已经将选项卡类型设置为NavigationController,将ViewController子类设置为选项卡的标识。我还为选项卡设置了NIB名称。当我在NavigationContollers中使用任何其他选项卡时,一切都正常,但有一个特定视图引发了一个异常,该类不符合key TXT Password的键值编码 该属性在ViewController接口中声明为UINavigationViewControlle
有没有办法找到原因?您的.xib可能在视图中引用了一个未定义的txtPassword属性-例如@synthesis缺失。您的.xib可能在视图中引用了一个未定义的txtPassword属性-例如@synthesis缺失。结果表明我拥有一个我的UITabController中的选项卡设置为UINavigationController子类的实例,并且该选项卡的类型设置为导航控制器。我需要的是在选项卡中设置UIView的类标识,而不是选项卡本身。结果是,我将UITableController中选项卡的类标识设置为UINavigationController子类的实例,并且选项卡的类型设置为navigation controller。我需要的是在选项卡中设置UIView的类标识,而不是选项卡本身。但是插座在IB中被合成和连接。但是IB中所有曾经有插座的视图都仍然有插座吗?例如,如果将一个IBOutlet属性挂接到IB中的一个视图,然后转到XCode并删除该属性,您将得到此错误,因为在.xib中,现在缺少的属性仍然被引用。但是这些outlet在IB中被合成并挂接。但是,IB中所有曾经有outlet的视图是否仍然有它们?例如,如果将一个IBOutlet属性挂接到IB中的一个视图上,然后转到XCode并删除该属性,您将得到这个错误,因为在.xib中,现在缺少的属性仍然被引用。
2011-07-14 17:11:10.784 myApp[5027:207] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x5a36500> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key txtPassword.'
*** Call stack at first throw:
(
0 CoreFoundation 0x013305a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x01484313 objc_exception_throw + 44
2 CoreFoundation 0x013304e1 -[NSException raise] + 17
3 Foundation 0x00195677 _NSSetUsingKeyValueSetter + 135
4 Foundation 0x001955e5 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 285
5 UIKit 0x0061930c -[UIRuntimeOutletConnection connect] + 112
6 CoreFoundation 0x012a68cf -[NSArray makeObjectsPerformSelector:] + 239
7 UIKit 0x00617d23 -[UINib instantiateWithOwner:options:] + 1041
8 UIKit 0x00619ab7 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
9 UIKit 0x004cf628 -[UIViewController _loadViewFromNibNamed:bundle:] + 70
10 UIKit 0x004cd134 -[UIViewController loadView] + 120
11 UIKit 0x004cd00e -[UIViewController view] + 56
12 UIKit 0x004cb482 -[UIViewController contentScrollView] + 42
13 UIKit 0x004dbf25 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 48
14 UIKit 0x004da555 -[UINavigationController _layoutViewController:] + 43
15 UIKit 0x004db870 -[UINavigationController _startTransition:fromViewController:toViewController:] + 524
16 UIKit 0x004d632a -[UINavigationController _startDeferredTransitionIfNeeded] + 266
17 UIKit 0x005f12e9 -[UILayoutContainerView layoutSubviews] + 226
18 QuartzCore 0x00f5aa5a -[CALayer layoutSublayers] + 181
19 QuartzCore 0x00f5cddc CALayerLayoutIfNeeded + 220
20 QuartzCore 0x00f020b4 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 310
21 QuartzCore 0x00f03294 _ZN2CA11Transaction6commitEv + 292
22 QuartzCore 0x00f0346d _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 99
23 CoreFoundation 0x0131189b __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 27
24 CoreFoundation 0x012a66e7 __CFRunLoopDoObservers + 295
25 CoreFoundation 0x0126f1d7 __CFRunLoopRun + 1575
26 CoreFoundation 0x0126e840 CFRunLoopRunSpecific + 208
27 CoreFoundation 0x0126e761 CFRunLoopRunInMode + 97
28 GraphicsServices 0x01acd1c4 GSEventRunModal + 217
29 GraphicsServices 0x01acd289 GSEventRun + 115
30 UIKit 0x0042bc93 UIApplicationMain + 1160
31 myApp 0x00001f44 main + 102
32 myApp 0x00001ed5 start + 53
)
terminate called after throwing an instance of 'NSException'