Anju Kumbharkar
Anju Kumbharkar

Reputation: 41

[<__NSCFString 0x7f8392695300> valueForUndefinedKey:]: this class is not key value coding-compliant for the key name.'

Terminating app due to uncaught exception

NSUnknownKeyException', reason: '[<__NSCFString 0x7f8392695300> valueForUndefinedKey:]: this class is not key value coding-compliant for the key name.

getting an exception.. i am trying to display database values to 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"]];

Upvotes: 1

Views: 1515

Answers (4)

SARATH SASI
SARATH SASI

Reputation: 1415

Check your storyboard n clear the warnings. There should be some connection errors or warningsin your case there will be some yellow marks, clear it n see

in your case there will be some yellow marks, clear it n see. it will work

Upvotes: 0

CW0007007
CW0007007

Reputation: 5681

[self.arrPeopleInfo objectAtIndex:indexPath.row]

Is returning a string, you are then attempting to call 'valueForKey:' on that and strings do not respond to that selector. Check that the contents of arrPeopleInfo are actually dictionaries.

Upvotes: 2

Paresh Navadiya
Paresh Navadiya

Reputation: 38239

Follow below steps:

1) Go to class xib file or if its in storyboard

2) Right click on UITableView, remove all earlier bindings

3) Add new binding by providing IBOutlet, delegate and datasource.

4) Clean project and run again.

Upvotes: 1

DDPWNAGE
DDPWNAGE

Reputation: 1443

The error means that your Table View isn't key-value compliant, meaning that KVP's (Key-Value Pairs) are unavailable for that type of object.

Upvotes: 0

Related Questions