Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Chapter 4: app crashes when loading Detail view

when i click to create or edit a hero, the app crashes in the following code:

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


    static NSString *CellIdentifier = @"SuperDBEditCell";

    SuperDBEditCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil) {

        cell = [[SuperDBEditCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:CellIdentifier];


    // Configure the cell...

    NSUInteger sectionIndex = [indexPath section];

    NSUInteger rowIndex = [indexPath row];


    NSDictionary *section = [self.sections objectAtIndex:sectionIndex];

    NSArray *rows = [section objectForKey:@"rows"];

    NSDictionary *row = [rows objectAtIndex:rowIndex];

    cell.textLabel.text = [row objectForKey:@"label"];

    cell.textField.text = [[self.hero valueForKey:[row objectForKey:@"key"]] description];// Crashes here!


    return cell;


and i receive the following warning from the console:

013-03-30 09:20:15.534 SuperDB[447:c07] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<NSManagedObject 0x814df10> valueForUndefinedKey:]: the entity Hero is not key value coding-compliant for the key "(null)".'

why is that happening? i guess my code is written well!


  • okay solved the problem. and it was a syntax error. i typed "plist" instead of ".plist" in viewDidLoad.
Sign In or Register to comment.