***断言失败 - [UITableView _configureCellForDisplay:forIndexPath:] [英] *** Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:]

查看:668
本文介绍了***断言失败 - [UITableView _configureCellForDisplay:forIndexPath:]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在项目中使用tableview apple的延迟加载代码,但在项目中有异常。错误是 - ***断言失败 - [UITableView _configureCellForDisplay:forIndexPath:] ,这里是我的代码请帮忙。但它正在其他项目中工作。我没有委托方法。

I am using tableview apple's lazy loading code in my project,but having exception in project. And error is - *** Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:],here is my code please help.But it is working in other project.I have no delegate method.

   - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
    static NSString *CellIdentifier = @"LazyTableCell";
    static NSString *PlaceholderCellIdentifier = @"PlaceholderCell";

    NSUInteger nodeCount = [self.entries count];

if (nodeCount == 0 && indexPath.row == 0)
    {
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:PlaceholderCellIdentifier];
    cell.detailTextLabel.text = @"Loading…";

    return cell;
    }

   UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

if (nodeCount > 0)
{
     AppRecord *appRecord = [self.entries objectAtIndex:indexPath.row];

     cell.textLabel.text = appRecord.name;


    if (!appRecord.appIcon)
    {
        if (self.mytable_view.dragging == NO && self.mytable_view.decelerating == NO)
        {
            [self startIconDownload:appRecord forIndexPath:indexPath];
        }

        cell.imageView.image = [UIImage imageNamed:@"Placeholder.png"];
    }
    else
    {
        cell.imageView.image = appRecord.appIcon;
    }

}

return cell;

}


推荐答案

因为 cellForRowAtIndexPath 返回 nil 值,然后 configureCellForDisplay 期待a 的UITableViewCell 。故事板或 XIB 没有使用您指定的单元格标识符定义的单元格。更好地检查标识符的拼写。

Because cellForRowAtIndexPath is returning a nil value and then configureCellForDisplay is expecting a UITableViewCell. The storyboard or XIB does not have a cell defined with the cell identifier you specified. Better check the spelling of identifier.

这篇关于***断言失败 - [UITableView _configureCellForDisplay:forIndexPath:]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆