Search code examples
iosuitableviewpushviewcontrollerlldb

lldb breakpoint, loaded nib but didn't get a UITableView


I have an app with no nibs. Its rootviewcontroller is a tableviewcontroller. I am having it push to a second tableviewcontroller, which controls a detailview. Just earlier this week, I had it successfully pushing to the next tableviewcontroller. A few days later (and after maybe saving the wrong version),

I get an

(lldb) with a breakpoint at the pushViewController method when I select a table item. I have breakpoints for all exceptions enabled. If I press the play button twice more, I get this in my output box:

" ** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UITableViewController loadView] loaded the "TopicsDetailViewController" nib but didn't get a UITableView.'"

Is there something wrong here or do I need to look elsewhere in my project?

This is in my header interface:

    TopicsDetailViewController *tdvController;

: ) And this is my didSelectRowAt...

       tdvController = [[TopicsDetailViewController alloc] init];

             tdvController.aFeed = afeed;
    [self.navigationController pushViewController:tdvController animated:YES];
    tdvController = nil;

Thank you, and let me know if I'm barking up the wrong tree.


Solution

  • If I'm understanding this correctly, your tdvController declaration in the interface file is named the same as the tdvController in the instance method where you are getting the exception.

    If your intentions are to create and use the instance variable in this instance method don't declare it again, just do:

    self.tdvcController = [[TopicsDetailViewController alloc] init];

    Which is creating the object on the heap.

    If you intentions are to use a local variable of type TopicsDetailViewController in this instance method that is not the iVar, then rename the local variable to something else.