Note that there are some explanatory texts on larger screens.

plurals
  1. PONavigation controller push nil view controller error
    text
    copied!<p>I'm having some problems with a Navigation controller in my app. Moving from the RootViewController to a UITableViewController works fine. I now want to have one more level of drilldown, so users pick an item from the list and a new screen appears, like this:</p> <p><code>RootViewController --&gt; TableViewController --&gt; ItemViewController</code></p> <p>I've used the exact same code that switches the first views, but I get:</p> <p><code>Application tried to push a nil view controller on target &lt;UINavigationController...</code></p> <p>The code is identical to the first one, so how can it be nil?</p> <p>In RootViewController.h:</p> <pre><code>@interface RootViewController : UIViewController { IBOutlet TableViewController *tableViewController; } @property (nonatomic, retain) TableViewController * tableViewController; </code></pre> <p>In the .m file I synthesize the property and then use a button to call:</p> <p><code>[self.navigationController pushViewController:tableViewController animated:YES];</code></p> <p>In TableViewController.h:</p> <pre><code>#import "ItemDetailViewController.h" @class TableViewController; @interface TableViewController : UITableViewController { IBOutlet ItemDetailViewController * itemDetailViewController; } @property (nonatomic, retain) ItemDetailViewController * itemDetailViewController; @end </code></pre> <p>And again, I synthesize it in the .m file and use code to push the new view in <code>didSelectRowAtIndexPath:</code></p> <p><code>[self.navigationController pushViewController:itemDetailViewController animated:YES];</code></p> <p>When you tap on an item I get the error message above. Does anyone have any idea why this is happening?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload