views:

959

answers:

1

In Navigation-based App, when i try to load another view which has got implemented UITableView using initWithNibName:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    UIViewController *detailsViewController = [[UIViewController alloc] initWithNibName:@"bloop2ViewController" bundle:nil];
    [[self navigationController] pushViewController:detailsViewController animated:YES];
    [detailsViewController release];
}

after clicking UITableView cell i get:

2009-06-13 11:44:41.089 Bloop[75227:20b] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0xd446f0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key tableView.' 2009-06-13 11:44:41.092 Bloop[75227:20b] Stack: (
807902715, 2429103675, 808061681, 810717848, 810716389, 816538544, 807805711, 816533170, 816541363, 815230552, 815224116, 815223834, 815217291, 815258907, 815254969, 815262662, 815243017, 815265053, 815242666, 11044, 815018240, 815005661, 810768858, 807687328, 807683624, 839142449, 839142646, 814752238, 9088, 8942 )

But when i disconnect UITableView in InterfaceBuilder, view is loaded without any problems (except there's no way to push data into it).

UITableView implementation is proper - i tried it in a fresh XCode project, and it worked just fine.

+3  A: 

The error message says you are trying to set the property "tableView" on an object of type UIViewController, which it does not have. I am just guessing, but maybe you have a derived view controller in your nib file, that has the property tableView, but then you construct not your derived object, but a UIViewController. You should try:

MyTableViewController *detailsViewController = [[MyTableViewController alloc] initWithNibName:@"bloop2ViewController" bundle:nil];
nschmidt
Works like a charm... I've spent whole day tracking this down, I seriously owe you :)Thanks again, and take care!
wojciechgabrys.com
Also just spent 2 hours tracking down this bug. Thanks for this answer.
Mutewinter