• 转:Assertion failure in [UITableView _configureCellForDisplay:forIndexPath:]


    Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:]
    今天做一个tableView遇到一个这么个问题。
    经过baidu google,终于找到正解。
    因为
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath     *)indexPath
    这个函数的返回值是个null!!
    查stackoverflow 找到下面的解。
    CellIdentifier I bet your cellForRowAtIndexPath is returning null.
    
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath     *)indexPath
    {
        static NSString *CellIdentifier = @"Photos";
    
        /** NOTE: This method can return nil so you need to account for that in code */
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    
        // NOTE: Add some code like this to create a new cell if there are none to reuse
        if(cell == nil)
        {
            cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    
        }
    
        NSString *string = [[self.photosInPlace objectAtIndex:indexPath.row]     valueForKeyPath:@"description._content"];
    
        cell.textLabel.text = string;
    
        return cell;
    }
    That's probably why [UITableView _configureCellForDisplay:forIndexPath:] is failing... becausecellForRowAtIndexPath is returning a null value and then configureCellForDisplay is expecting aUITableViewCell.

    转:http://blog.csdn.net/theonezh/article/details/8613593

  • 相关阅读:
    [linux] 内存检测
    [思维]牛客编程巅峰赛S1第6场
    [逆序数, 思维]牛客编程巅峰赛S1第5场
    [Linux] TrafficControl 流量控制
    [linux]常用指令
    [带权并查集]小白月赛25-C 白魔法师
    初窥原型
    性能测试流程
    JMeter服务器监控技术
    使用Fiddler进行HTTPS抓包和手机APP抓包
  • 原文地址:https://www.cnblogs.com/ygm900/p/3134425.html
Copyright © 2020-2023  润新知