首页 > xcode6如何调试定位错误

xcode6如何调试定位错误

2015-05-14 21:00:40.736 HavFun[10042:14937966] *** Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:], /SourceCache/UIKit_Sim/UIKit-3347.44/UITableView.m:7524
2015-05-14 21:00:40.753 HavFun[10042:14937966] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:'
*** First throw call stack:
(
0 CoreFoundation 0x000000010b4eac65 exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010a1c7bb7 objc_exception_throw + 45
2 CoreFoundation 0x000000010b4eaaca +[NSException raise:format:arguments:] + 106
3 Foundation 0x0000000109ddc98f -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195
4 UIKit 0x000000010c56aa83 -[UITableView _configureCellForDisplay:forIndexPath:] + 128
5 UIKit 0x000000010c572a41 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 533
6 UIKit 0x000000010c551248 -[UITableView _updateVisibleCellsNow:isRecursive:] + 2853
7 UIKit 0x000000010c5601b4 -[UITableView _visibleCells] + 27
8 UIKit 0x000000010c56326d -[UITableView setSeparatorStyle:] + 176
9 HavFun 0x0000000107d17800 -[ChatListViewController tableView] + 1200
10 HavFun 0x0000000107d16249 -[ChatListViewController viewDidLoad] + 297
11 UIKit 0x000000010c5a2210 -[UIViewController loadViewIfRequired] + 738
12 UIKit 0x000000010c5d201b -[UINavigationController _layoutViewController:] + 44
13 UIKit 0x000000010c5d2565 -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 216
14 UIKit 0x000000010c5d2664 -[UINavigationController _startTransition:fromViewController:toViewController:] + 92
15 UIKit 0x000000010c5d3448 -[UINavigationController _startDeferredTransitionIfNeeded:] + 523
16 UIKit 0x000000010c5d3f0e -[UINavigationController __viewWillLayoutSubviews] + 43
17 UIKit 0x000000010c71e715 -[UILayoutContainerView layoutSubviews] + 202
18 UIKit 0x000000010c4f1a2b -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 536
19 QuartzCore 0x0000000109bbbec2 -[CALayer layoutSublayers] + 146
20 QuartzCore 0x0000000109bb06d6 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
21 QuartzCore 0x0000000109bb0546 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
22 QuartzCore 0x0000000109b1c886 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 242
23 QuartzCore 0x0000000109b1da3a _ZN2CA11Transaction6commitEv + 462
24 UIKit 0x000000010c495309 _afterCACommitHandler + 120
25 CoreFoundation 0x000000010b41dca7 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION
+ 23
26 CoreFoundation 0x000000010b41dc00 __CFRunLoopDoObservers + 368
27 CoreFoundation 0x000000010b413a33 __CFRunLoopRun + 1123
28 CoreFoundation 0x000000010b413366 CFRunLoopRunSpecific + 470
29 GraphicsServices 0x000000010f24ea3e GSEventRunModal + 161
30 UIKit 0x000000010c471900 UIApplicationMain + 1282
31 HavFun 0x0000000107d81e0f main + 111
32 libdyld.dylib 0x000000010d88d145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException


红框中是错误信息。
在tableView cellforRowatindexpath方法中,你没有返回cell.
如果你沾上源代码的话,可能会更容易解决。
如果你是因为工程太大,不知道蹦在那个ViewControler的话,你可以添加一个全局异常断点。如下图:
之后你再运行程序,就会停到崩溃的地方啦。

你的取cell的方法不对。
箭头指的地方,这个方法你需要[sampTableView registerClass:[UITableViewCell class] forCellReuseIdentifier:sampTableViewIdentifier];
先注册一个cell的类型才能用这个取cell.
你改了再试试。

【热门文章】
【热门文章】