Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/103.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios [<;uu NSCFString 0x7f8392695300>;valueForUndefinedKey:]:此类不符合密钥名称的键值编码;_Ios_Objective C_Iphone - Fatal编程技术网

Ios [<;uu NSCFString 0x7f8392695300>;valueForUndefinedKey:]:此类不符合密钥名称的键值编码;

Ios [<;uu NSCFString 0x7f8392695300>;valueForUndefinedKey:]:此类不符合密钥名称的键值编码;,ios,objective-c,iphone,Ios,Objective C,Iphone,由于未捕获异常而终止应用程序 NSUnknownKeyException',原因:'[valueForUndefinedKey:]:此类不符合密钥名称的键值编码 正在获取一个异常。。我正在尝试向tableview显示数据库值 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { // Dequeue the cell. //s

由于未捕获异常而终止应用程序

NSUnknownKeyException',原因:'[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"]];

该错误表示您的表视图不符合键值,这意味着KVP(键值对)对于该类型的对象不可用。

请遵循以下步骤:

1) 转到class
xib
文件,或者如果它在
故事板中

2) 右键单击
UITableView
删除所有早期的
绑定

3) 通过提供
IBOutlet
delegate
datasource
添加新绑定


4)
清理
项目
并再次运行。

检查情节提要并清除警告。应该有一些连接错误或警告

在你的情况下,会有一些黄色标记,请清除它。它会起作用的

[self.arrPeopleInfo objectAtIndex:indexPath.row]

如果返回一个字符串,则尝试调用该字符串上的“
valueForKey
:”,而字符串不响应该选择器。检查
arrPeopleInfo
的内容实际上是字典。

只需检查是否已将tableview的输出正确设置为同一类,将datasource和delegate设置为Welltw。您如何初始化UITableViewCell?若单元格为零,只需在NSInteger行上使用断点进行检查。若可以,请使用方法更改值。我不知道具体细节,因为我不经常使用表和数据库。我同意上面普林斯的回答。这就是我要找的。干得好;)