您的位置:首页 > 产品设计 > UI/UE

Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:]

2016-03-15 16:59 543 查看
一般情况下,此种错误应该检查cell返回的到底是不是空。
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 reuseif(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.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: