title: Crash when handling remote notification when app not running
body: <p>I receive a remote notification and according to the type of notification, change navigation controller's view controllers. </p>
  
  <p>It all works fine when the app is in the foreground, or when the app is in the background but not completely closed (from multi-tasking bar). </p>
  
  <p>But, when the app is closed, and receives a remote notification it crashes as soon as it opens. Am I doing wrong with the way I am setting up the ViewControllers? </p>
  
  <p>Here's some code. </p>
  
  <pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary
  *)launchOptions {
     // Push required screens into navigation controller
  
           UILocalNotification *remoteNotif = [launchOptions objectForKey: UIApplicationLaunchOptionsRemoteNotificationKey];
  
      //Accept push notification when app is not open
      if (remoteNotif) {      
          [self handleRemoteNotification:application userInfo:remoteNotif.userInfo];
          return YES;
      }
  
      [window addSubview:navigationController.view];
      [window makeKeyAndVisible];
  
      return YES;
  }
  
  -(void) handleRemoteNotification:(UIApplication *)application userInfo:(NSDictionary *)userInfo {
      application.applicationIconBadgeNumber = 0;
  
  NSMutableArray *viewControllers = [NSMutableArray array];
      [viewControllers addObject:driverWaitViewController];
      [viewControllers addObject:newJobsViewController];
  
      [navigationController setViewControllers:viewControllers];
  }
  </code></pre>