【发布时间】:2015-06-23 21:04:05
【问题描述】:
由于未捕获的异常而终止应用程序
NSUnknownKeyException', reason: '[<__nscfstring> valueForUndefinedKey:]: 这个类不符合键名的键值编码。
遇到异常.. 我正在尝试向 tableview 显示数据库值
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
// Dequeue the cell.
//static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"idCellRecord" forIndexPath:indexPath];
NSInteger indexOfFirstname = [self.dbManager.arrColumnNames indexOfObject:@"name"];
NSInteger indexOfLastname = [self.dbManager.arrColumnNames indexOfObject:@"fname"];
cell.textLabel.text = [NSString stringWithFormat:@ "%@ %@", [[self.arrPeopleInfo objectAtIndex:indexPath.row]valueForKey:@"name"], [[self.arrPeopleInfo objectAtIndex:indexPath.row] valueForKey:@"fname"]];
【问题讨论】:
-
只需检查您是否已将 tableview 的插座正确设置为同一类,以及数据源和委托
-
顺便说一句,你是如何初始化 UITableViewCell 的?如果单元格为零,只需检查 NSInteger 行上的断点
标签: ios objective-c iphone