首页 > 移动平台 > 详细

iOS Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'unable to

时间:2014-11-13 12:58:26      阅读:680      评论:0      收藏:0      [点我收藏+]

刚接触iOS,按照教程操作运行出现错误

Terminating app due to uncaught exception ‘NSInternalInconsistencyException‘, reason: ‘unable to dequeue a cell with identifier Cell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard


解决办法是加一句:

[self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:CellIdentifier]; 


加的位置是:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 

    static NSString *CellIdentifier = @"ListPrototypeCell"; 
    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:CellIdentifier]; 
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; 

    // config cell
 XYZToDoItem * toDoItem = [self.toDoItem objectAtIndex:indexPath.row];

    cell.textLabel.text = toDoItem.itemName;


   return cell; 
}

由于刚学习IOS,原因不明

iOS Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'unable to

原文:http://blog.csdn.net/liyun123gx/article/details/41075625

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!