popViewControllerAnimated won't work inside viewDidAppear
<p>I have a navigation based application which has multiple views (Say root &lt;- A &lt;- B &lt;- C). What I want to do is that when users pop out of the top most view (C) to view B, automatically execute some checks in view B and if met, go to view A.</p>

<p>What I did is the following:</p>

<p>In class B which is a UITableViewController</p>

<pre><code>- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];

    BOOL completed = NO;

    // The logic that sets completed is here

    if (completed)
    {
        // OK I want to pop out to the previous view controller (A)
        [self.navigationController popViewControllerAnimated:YES];
    }
}
</code></pre>

<p>}</p>

<p>What happens is that the debug stops telling me that navigationController has already been deallocated. Not so sure why</p>

<p>Any ideas?</p>
