【发布时间】:2012-08-17 04:39:24
【问题描述】:
我正在尝试开发一个简单的应用程序,该应用程序显示来自 sqlite3 数据库中的名称。
它返回一个错误:
2012-08-21 21:10:43.182 NameDatabase[1325:c07] 断言失败 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:]; /SourceCache/UIKit_Sim/UIKit-1914.84/UITableView.m:6061 2012-08-21 21:10:43.184 NameDatabase[1325:c07] 由于未捕获而终止应用程序 异常'NSInternalInconsistencyException',原因:'UITableView dataSource 必须从 tableView 返回一个单元格:cellForRowAtIndexPath:'
我已经尝试了很多方法来解决这个问题,但我没有想法。
这是我认为导致问题的方法:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"CustomerCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
NameClass *name_class = [self.name_vc objectAtIndex:[indexPath row]];
cell.textLabel.text = name_class.name;
//[[cell textLabel] setText:[NSString stringWithFormat:@"%@ ,@%d",name_class.name, name_class.id]];
return cell;
}
【问题讨论】:
-
这里是整个代码的链接:db.tt/QfAPzsCz
标签: objective-c xcode uitableview fmdb