用xib自定义UITableviewCell时遇到一个崩溃,最后的堆栈跟这篇文章有点类似:
2011-10-27 04:49:08.376 login[1192:207] * Terminating app due to uncaught exception ‘NSInternalInconsistencyException‘, reason: ‘Could not load NIB in bundle: ‘NSBundle (loaded)‘ with name ‘LoginView‘‘ * Call stack at first throw: ( 0 CoreFoundation 0x00dc85a9 __exceptionPreprocess + 185 1 libobjc.A.dylib 0x00f1c313 objc_exception_throw + 44 2 CoreFoundation 0x00d80ef8 +[NSException raise:format:arguments:] + 136 3 CoreFoundation 0x00d80e6a +[NSException raise:format:] + 58 4 UIKit 0x004b30fa -[UINib instantiateWithOwner:options:] + 2024 5 UIKit 0x004b4ab7 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168 6 UIKit 0x0036a628 -[UIViewController _loadViewFromNibNamed:bundle:] + 70 7 UIKit 0x00368134 -[UIViewController loadView] + 120 8 UIKit 0x0036800e -[UIViewController view] + 56 9 login 0x000029c3 -[loginViewController viewDidLoad] + 165 10 UIKit 0x004b2f26 -[UINib instantiateWithOwner:options:] + 1556 11 UIKit 0x004b4ab7 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168 12 UIKit 0x002ba17a -[UIApplication _loadMainNibFile] + 172 13 UIKit 0x002bacf4 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 291 14 UIKit 0x002c5617 -[UIApplication handleEvent:withNewEvent:] + 1533 15 UIKit 0x002bdabf -[UIApplication sendEvent:] + 71 16 UIKit 0x002c2f2e _UIApplicationHandleEvent + 7576 17 GraphicsServices 0x01720992 PurpleEventCallback + 1550 18 CoreFoundation 0x00da9944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52 19 CoreFoundation 0x00d09cf7 __CFRunLoopDoSource1 + 215 20 CoreFoundation 0x00d06f83 __CFRunLoopRun + 979 21 CoreFoundation 0x00d06840 CFRunLoopRunSpecific + 208 22 CoreFoundation 0x00d06761 CFRunLoopRunInMode + 97 23 UIKit 0x002ba7d2 -[UIApplication _run] + 623 24 UIKit 0x002c6c93 UIApplicationMain + 1160 25 login 0x00002694 main + 102 26 login 0x00002625 start + 53 ) terminate called after throwing an instance of ‘NSException‘
在Xcode中还显示了这样的关键一句错误信息:
Terminating app due to uncaught exception ‘NSUnknownKeyException‘, reason: ‘[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the keyaRemovedView.‘“
定位到的错误原因为将自定义的CustomTableviewCell的File‘s Owner的Class设置为了CustomTableviewCell,而实际上不用设置,只需要将TableView Cell的class设置为它即可。因为自己将cell重命名了,沿用了UIViewController的习惯修改了File‘s Owner的Class设置,惯性思维啊
this class is not key value coding-compliant for t
原文:http://my.oschina.net/ioslighter/blog/390495