title: Push Notification -didFinishLaunchingWithOptions
body: <p>When I send a push notification and my app is open or in the background and I click on the push notification, my application redirects to <code>PushMessagesVc</code> <code>viewController</code> (<em>as intended</em>)</p>
  
  <p>I use the code as below for this:</p>
  
  <pre><code>-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
      UIStoryboard *mainstoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
      PushMessagesVc *pvc = [mainstoryboard instantiateViewControllerWithIdentifier:@"PushMessagesVc"];
  
      [self.window.rootViewController presentViewController:pvc
                                                   animated:YES
                                                 completion:NULL];
  }
  </code></pre>
  
  <p>There is no problem in the code/scenario above but if the application is closed and I click on a push notification, the application does not redirect my <code>PushMessagesVc</code> <code>viewController</code> in this case &amp; the application stays on the main screen.</p>
  
  <p>For the 2nd scenario, I use the following code:</p>
  
  <pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  {
      sleep(1);
      [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeNone)];
      [UIApplication sharedApplication].applicationIconBadgeNumber = 1;
  
      NSDictionary *userInfo = [launchOptions valueForKey:@"UIApplicationLaunchOptionsRemoteNotificationKey"];
      NSDictionary *apsInfo = [userInfo objectForKey:@"aps"];
  
      if(apsInfo) {
          UIStoryboard *mainstoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
          PushMessagesVc* pvc = [mainstoryboard instantiateViewControllerWithIdentifier:@"PushMessagesVc"];
          [self.window.rootViewController presentViewController:pvc animated:YES completion:NULL];
          return YES;
      }
      return YES;
  }
  </code></pre>
  
  <p>But in this case, the <code>PushMessagesVc</code> does not appear.</p>