Note that there are some explanatory texts on larger screens.

plurals
  1. POUITabbarController dismiss modal UINavigationController
    primarykey
    data
    text
    <p>I got a very interesting problem here. My iPhone app has an UITabbarController as rootViewController in the AppDelegate.</p> <p>If the app is opened the first time, it must be configured basically. For this purpose I create an UINavigationController and tell the tabbarController to present it modally:</p> <pre><code>firstRun = [[firstRunViewController alloc] init]; navCtrl = [[UINavigationController alloc] initWithRootViewController:firstRun]; [[self tabBarController] presentModalViewController:navCtrl animated:NO]; </code></pre> <p>When the configuration is done, I'd like to get rid of the firstRunViewController. I'm using this technique very often, using <code>-dismissModalViewControllerAnimated:</code>.</p> <p>But in this constellation this doesn't work. It doesn't matter from what controller I'm calling the dismiss. I tried it via the tabbarController, the rootViewController, the currently active viewController, of cause self and several other controllers.</p> <p>EVERY TIME I call <code>-dismissModalViewControllerAnimated:</code> I get this exception:</p> <pre><code>'UIViewControllerHierarchyInconsistency', reason: 'presentedViewController for controller is itself on dismiss for: &lt;UINavigationController:… </code></pre> <p>Can anybody help? Thanks in advance, with kind regards, Julian</p> <p><strong>EDIT</strong> In my AppDelegate I'm using a UITabbarController as rootViewController for the main window:</p> <pre><code>self.window.rootViewController = self.tabBarController; [self.window makeKeyAndVisible]; </code></pre> <p>Then I'm creating an UINavigationController and tell the UITabbarController to present the modalViewController:</p> <pre><code>UINavigationController *navCtrl = [[UINavigationController alloc] initWithRootViewController:firstRun]; [[self tabBarController] presentModalViewController:navCtrl animated:NO]; </code></pre> <p>When I now call -dismissModalViewControllerAnimated: on the firstViewController I'm getting the error from above.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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