今天一个朋友有个bug没能解决,让我帮他看一下,具体信息是:
2011-05-30 13:43:28.494 localShowImg[2305:207] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIApplication 0x4d031a0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key view.' *** Call stack at first throw: ( 0 CoreFoundation 0x00da7be9 __exceptionPreprocess + 185 1 libobjc.A.dylib 0x00efc5c2 objc_exception_throw + 47 2 CoreFoundation 0x00da7b21 -[NSException raise] + 17 3 Foundation 0x007796cf _NSSetUsingKeyValueSetter + 135 4 Foundation 0x0077963d -[NSObject(NSKeyValueCoding) setValue:forKey:] + 285 5 UIKit 0x002098d6 -[UIRuntimeOutletConnection connect] + 112 6 CoreFoundation 0x00d1e2cf -[NSArray makeObjectsPerformSelector:] + 239 7 UIKit 0x002082ed -[UINib instantiateWithOwner:options:] + 1041 8 UIKit 0x0020a081 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168 9 UIKit 0x00014943 -[UIApplication _loadMainNibFile] + 172 10 UIKit 0x000154ca -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 291 11 UIKit 0x0001fdb2 -[UIApplication handleEvent:withNewEvent:] + 1533 12 UIKit 0x00018202 -[UIApplication sendEvent:] + 71 13 UIKit 0x0001d732 _UIApplicationHandleEvent + 7576 14 GraphicsServices 0x0101ca36 PurpleEventCallback + 1550 15 CoreFoundation 0x00d89064 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52 16 CoreFoundation 0x00ce96f7 __CFRunLoopDoSource1 + 215 17 CoreFoundation 0x00ce6983 __CFRunLoopRun + 979 18 CoreFoundation 0x00ce6240 CFRunLoopRunSpecific + 208 19 CoreFoundation 0x00ce6161 CFRunLoopRunInMode + 97 20 UIKit 0x00014fa8 -[UIApplication _run] + 636 21 UIKit 0x0002142e UIApplicationMain + 1160 22 localShowImg 0x000021e9 main + 121 23 localShowImg 0x00002165 start + 53 ) terminate called after throwing an instance of 'NSException' Program received signal: “SIGABRT”.
我估计是xib里面有问题,就问他是否某个IBOutlet没连线,他回答说没有,因为是QQ联系,不能现场看具体情况,我让他打包发邮箱,我打开来看,确实是这个错误,确实xib没啥问题,即使把其他地方注释掉,只留下面这句也还是报错...
[self.window makeKeyAndVisible];
我就怀疑是不是配置有问题,果然...在info.plist文件里面Main nib file base name居然填的不是MainWindow,汗,居然有这种失误.
当我准备给他QQ上说的时候,发现他离线了,留了句:"我重装工具了...果断点",汗,蝈蝈无语了...
后来他重装没装起,也算万幸,毕竟新手,路还很长,谨以此文,共勉之