如果此文帮助了您,请点击喜欢或评论,您的支持永远都是我前行的动力.
本人在关于viewController中的添加tableView时一直显示此错误(错误如下),
2016-01-08 17:04:41.647 playerOnline[4502:371177] *** Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3512.30.14/UITableView.m:7962
2016-01-08 17:04:41.662 playerOnline[4502:371177] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UITableView (<UITableView: 0x7fbc3a0cf600; frame = (0 154; 414 1000); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x7fbc38d27490>; layer = <CALayer: 0x7fbc38dc8450>; contentOffset: {0, 0}; contentSize: {414, 4400}>) failed to obtain a cell from its dataSource (<DataListViewController: 0x7fbc38c80f30>)'
经过解决,发现在tableView cellForRowAtIndexPath的方法中添加一句话问题就可以解决(添加图中注释的语句).
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell *ncell = [tableView dequeueReusableCellWithIdentifier:identifierdata];
// if(ncell == nil){
//
//ncell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifierdata];
//
// }
转载请注明出处.