2011-07-15 14:32:13.218 testXml[3486:207] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<testXmlViewController 0x4e1b450> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key levels.'
*** Call stack at first throw:
(
0 CoreFoundation 0x00eea5a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0103e313 objc_exception_throw + 44
2 CoreFoundation 0x00eea4e1 -[NSException raise] + 17
3 Foundation 0x00152677 _NSSetUsingKeyValueSetter + 135
4 Foundation 0x001525e5 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 285
5 UIKit 0x005d630c -[UIRuntimeOutletConnection connect] + 112
6 CoreFoundation 0x00e608cf -[NSArray makeObjectsPerformSelector:] + 239
7 UIKit 0x005d4d23 -[UINib instantiateWithOwner:options:] + 1041
8 UIKit 0x005d6ab7 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
9 UIKit 0x0048c628 -[UIViewController _loadViewFromNibNamed:bundle:] + 70
10 UIKit 0x0048a134 -[UIViewController loadView] + 120
11 UIKit 0x0048a00e -[UIViewController view] + 56
12 UIKit 0x003fdd42 -[UIWindow addRootViewControllerViewIfPossible] + 51
13 UIKit 0x003fd22d -[UIWindow _setHidden:forced:] + 303
14 UIKit 0x003fd01d -[UIWindow _orderFrontWithoutMakingKey] + 50
15 UIKit 0x003fbcd1 -[UIWindow makeKeyAndVisible] + 39
16 testXml 0x00001ba2 -[testXmlAppDelegate application:didFinishLaunchingWithOptions:] + 135
17 UIKit 0x003dac89 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1163
18 UIKit 0x003dcd88 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 439
19 UIKit 0x003e7617 -[UIApplication handleEvent:withNewEvent:] + 1533
20 UIKit 0x003dfabf -[UIApplication sendEvent:] + 71
21 UIKit 0x003e4f2e _UIApplicationHandleEvent + 7576
22 GraphicsServices 0x01722992 PurpleEventCallback + 1550
23 CoreFoundation 0x00ecb944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
24 CoreFoundation 0x00e2bcf7 __CFRunLoopDoSource1 + 215
25 CoreFoundation 0x00e28f83 __CFRunLoopRun + 979
26 CoreFoundation 0x00e28840 CFRunLoopRunSpecific + 208
27 CoreFoundation 0x00e28761 CFRunLoopRunInMode + 97
28 UIKit 0x003dc7d2 -[UIApplication _run] + 623
29 UIKit 0x003e8c93 UIApplicationMain + 1160
30 testXml 0x00001af8 main + 102
31 testXml 0x00001a89 start + 53
)
terminate called after throwing an instance of 'NSException'
主要的原因是,我已经定义好的UITextField ,因为用不到了,so 删除了 代码中的代码,忘了删除xib中的控件了。
我删除空间后仍然无法加载view ,是编译的问题,chean 后 从新编译一下就Ok 了
更新:
内存的管理不当也会造成这样的错误 - 例如 内存的释放的位置 和 释放顺序 ,
还有就是日志输出错误时,用法错误,也可以导致上述错误的发生,
so 发生上述的错误原因有很多的方面
你要从你的程序的功能出发,一步一步的跟踪错误的发生位置~~