title: Presenting a specific view controller from AppDelegate
body: <p>I am trying to present a view controller (a passcode request type view) every time my app becomes active. Once the correct passcode is entered, it should pop off the stack. The passcode view I'm trying to push isn't the initial view controller, so I'm having trouble accessing it from the AppDelegate's applicationDidBecomeActive. </p>
  
  <p>I also tried pushing the passcode view from my MainViewController's ViewWillAppear, but it doesn't get called when the app becomes active; only when the screen is refreshed.</p>
  
  <p>I've been researching similar problems across SO the past couple days, but I'm still not understanding the proper method. I've heard that I might not be able to push the view this way because the applicationDidBecomeActive may be called before the Storyboard or NavigationController is connected/initialized/etc.</p>
  
  <p>If anyone could provide me with the correct way to push/present the view, or if there's somewhere else that'd be better to do this type of thing, I'd appreciate it. </p>
  
  <p><strong>Solved</strong>: I just deleted the view from storyboard and used a nib instead. I used:</p>
  
  <pre><code>PasscodeUnlockVC *passcodeUnlock = [[PasscodeUnlockVC alloc] initWithNibName:@"PasscodeUnlockVC" bundle:[NSBundle mainBundle]];
  [(UINavigationController *)self.window.rootViewController pushViewController:passcodeUnlock animated:NO];
  </code></pre>
  
  <p>View hierarchy data:</p>
  
  <pre><code>(gdb) po [[(id)UIApp keyWindow] recursiveDescription]
  &lt;UIWindow: 0x736a4b0; frame = (0 0; 320 480); layer = &lt;UIWindowLayer: 0x7367b40&gt;&gt;
     | &lt;UILayoutContainerView: 0x76977a0; frame = (0 0; 320 480); autoresize = W+H; layer =     &lt;CALayer: 0x769de60&gt;&gt;
     |    | &lt;UINavigationTransitionView: 0x7692110; frame = (0 0; 320 480); clipsToBounds = YES;      autoresize = W+H; layer = &lt;CALayer: 0x769a8c0&gt;&gt;
     |    |    | &lt;UIViewControllerWrapperView: 0x73868d0; frame = (0 64; 320 416); autoresize =  W+H; layer = &lt;CALayer: 0x75510e0&gt;&gt;
     |    |    |    | &lt;UIView: 0x76b93e0; frame = (0 0; 320 416); autoresize = W+H; layer = &lt;CALayer: 0x7386850&gt;&gt;
     |    | &lt;UINavigationBar: 0x73664b0; frame = (0 20; 320 44); clipsToBounds = YES; opaque =  NO; autoresize = W; layer = &lt;CALayer: 0x7366550&gt;&gt;
     |    |    | &lt;UINavigationBarBackground: 0x7360ea0; frame = (0 0; 320 44); opaque = NO; userInteractionEnabled = NO; layer = &lt;CALayer: 0x7366520&gt;&gt; - (null)
     |    |    | &lt;UINavigationItemView: 0x76b95e0; frame = (160 21; 0 0); opaque = NO; userInteractionEnabled = NO; layer = &lt;CALayer: 0x76aa8e0&gt;&gt;
     |    |    | &lt;UINavigationItemButtonView: 0x7550650; frame = (5 7; 73 30); opaque = NO;   userInteractionEnabled = NO; layer = &lt;CALayer: 0x7368b40&gt;&gt;
  Current language:  auto; currently objective-c
  (gdb) 
  </code></pre>