ios - ***断言失败-[UITableView _configureCellForDisplay :forIndexPath:]

标签 ios

我在我的项目中使用tableview apple 的延迟加载代码,但在项目中出现异常。错误是 - *** Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:],这是我的代码,请帮忙。但它在其他项目中工作。我没有委托(delegate)方法。

   - (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 需要一个 UITableViewCell。 Storyboard或 XIB 没有使用您指定的单元格标识符定义的单元格。最好检查标识符的拼写。

关于ios - ***断言失败-[UITableView _configureCellForDisplay :forIndexPath:],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20139259/

相关文章:

ios - swift 4 错误 : "Cannot convert value of type ' URLRequest' to expected argument type 'URL!' "

ios - 无法解析 json 错误 instamojo

ios - UI 项目不显示在界面生成器中

ios - inout 参数的外部实例的 Swift 内存地址与复制的实例相同

ios - 关于 Interface Builder 组件发布

ios - 将具有物理特性的 collada 场景加载到 SceneKit

iOS - ViewController 中的第三个 TableView 未加载 Nib

ios - 手动调用 viewWillAppear() 时出错(Objective-C)

ios - MkMapView 显示蓝屏

ios - 使用 .Value 和 .ChildAdded 检索数据