iOS   发布时间:2022-03-31  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了ios – Assertion failure in – [UITableView _configureCellForDisplay:forIndexPath:]大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
有人可以告诉我为什么我得到这个错误

这是我的.m文件

#import "ListaParticipantesViewController.h"
#import "Participantes.h"
#import "ModParticipantesViewController.h"

@implementation ListaParticipantesViewController

@synthesize dao;
@synthesize participantes;

- (void)viewDidLoad
{
    dao = [[ParticipantesDAO alloc] init];
    participantes = [[NSMutableArray alloc] init];
    participantes = [dao getDatos];
    [super viewDidLoad];

}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [participantes count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowATindexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"celda";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    cell.textLabel.text = [[participantes objectATindex:[indexPath row]] valueForKey:@"nombre"];

    return cell;
}

#pragma mark - Table view delegate

- (void)tableView:(UITableView *)tableView didSELEctRowATindexPath:(NSIndexPath *)indexPath
{

    ModParticipantesViewController *desTino = [self.storyboard instantiateViewControllerWithIdentifier:@"visualizacion"];
    Participantes *tmp = [participantes objectATindex:[indexPath row]];
    desTino.participante = tmp;

    [self.navigationController pushViewController:desTino animated:YES];
}

@end

显示错误是:

2013-04-13 17:40:20.235 Registro[5314:c07] *** Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:],/sourceCache/UIKit_Sim/UIKit-2380.17/UITableView.m:5471
2013-04-13 17:40:20.237 Registro[5314:c07] *** TerminaTing app due to uncaught exception 'NSInternalInconsistencyException',reason: 'UITableView datasource must return a cell from tableView:cellForRowATindexPath:'
*** First throw call stack:
(0x209d012 0x11aae7e 0x209ce78 0xc40665 0x1a4c1b 0x13940c 0x1a4a7b 0x1a9919 0x1a99cf 0x1921bb 0x1a2b4b 0x13f2dd 0x11be6b0 0x2699fc0 0x268e33c 0x2699eaf 0x1de2bd 0x126b56 0x12566f 0x125589 0x@R_801_10092@e4 0x12461e 0x1253d9 0x1282d2 0x1d299c 0x11f574 0x11f76f 0x11f905 0x128917 0xec96c 0xed94b 0xfecb5 0xffbeb 0xf1698 0x1ff8df9 0x1ff8ad0 0x2012bf5 0x2012962 0x2043bb6 0x2042f44 0x2042e1b 0xed17a 0xeeffc 0x306d 0x1ef5)
libc++abi.dylib: terminate called throwing an exception
(lldb)

提前致谢!

解决方法

故事板或XIB没有使用您指定的单元格标识符定义单元格.

大佬总结

以上是大佬教程为你收集整理的ios – Assertion failure in – [UITableView _configureCellForDisplay:forIndexPath:]全部内容,希望文章能够帮你解决ios – Assertion failure in – [UITableView _configureCellForDisplay:forIndexPath:]所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。