[UITableViewController loadView] loaded the “some-id” nib but didn’t get a UITableView.

The following error occurred when adding a UIView to the root of a NIB expecting that was loaded by a UITableViewController class.

uncaught exception 'NSInternalInconsistencyException', reason: '-[UITableViewController loadView] loaded the "some-id" nib but didn't get a UITableView.'

If you have a UITableViewController and your root element is not a UITableView, you should make your controller extend UIViewController (not UITableViewController) and implement the UITableViewDelegate and UITableViewDataSource interfaces.

Your header file would look like this.

@interface ContactUsViewController : UIViewController<UITableViewDelegate, UITableViewDataSource> {
    IBOutlet UITableView* tableView;
}

@property (nonatomic, retain) UITableView* tableView;

@end

You should also add a reference to the table so that you can access it in your implementation. You may have to extend the UITableView in order to extend the operations.

 

One thought on “[UITableViewController loadView] loaded the “some-id” nib but didn’t get a UITableView.

Leave a Reply