title: Open a ViewController from remote notification
body: <p>I try to open a particular ViewController when my app catch a remote notification.</p>
  
  <p>Let me show my project's architecture.
  Here my storyboard :
  <a href="https://i.stack.imgur.com/MgSVG.png" rel="noreferrer"><img src="https://i.stack.imgur.com/MgSVG.png" alt="enter image description here"></a> </p>
  
  <p>When I receive a notification I want open a "SimplePostViewController", so this is my appDelegate :</p>
  
  <pre><code>var window: UIWindow?
  var navigationVC: UINavigationController?
  
  func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -&gt; Bool {
      let notificationTypes: UIUserNotificationType = [UIUserNotificationType.Alert, UIUserNotificationType.Badge, UIUserNotificationType.Sound]
      let pushNotificationSettings = UIUserNotificationSettings(forTypes: notificationTypes, categories: nil)
      let storyboard = UIStoryboard(name: "Main", bundle: nil)
  
      self.navigationVC = storyboard.instantiateViewControllerWithIdentifier("LastestPostsNavigationController") as? UINavigationController
      application.registerUserNotificationSettings(pushNotificationSettings)
      application.registerForRemoteNotifications()
      return true
  }
  
  func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {
      if let postId = userInfo["postId"] as? String {
          print(postId)
  
          let api = EVWordPressAPI(wordpressOauth2Settings: Wordpress.wordpressOauth2Settings, site: Wordpress.siteName)
  
          api.postById(postId) { post in
              if (post != nil) {
                  self.navigationVC!.pushViewController(SimplePostViewController(), animated: true)
              } else {
                  print("An error occurred")
              }
          }
  
      }
  }
  </code></pre>
  
  <p>I save my UINavigationViewController when the app is launch and simply try to push a new SimplePostViewController when I receive a notification. But nothing happen.
  I placed breakpoints and seen that my pushViewController method was reached, but not the ViewWillAppear of my SimplePostViewController.</p>
  
  <p>I also used the "whats new" view add perform my segue but nothing happen too. </p>
  
  <p><strong>Solution :</strong></p>
  
  <pre><code>for child in (self.rootViewController?.childViewControllers)! {
      if child.restorationIdentifier == "LastestPostsNavigationController" {
         let lastestPostsTableViewController = (child.childViewControllers[0]) as! LastestPostsTableViewController
         let simplePostVC = (self.storyboard?.instantiateViewControllerWithIdentifier("PostViewController"))! as! PostViewController
  
         simplePostVC.post = post
         lastestPostsTableViewController.navigationController?.pushViewController(simplePostVC, animated: true)
      }
   }
  </code></pre>
  
  <p>I use :</p>
  
  <pre><code>child.childViewControllers[0]
  </code></pre>
  
  <p>because I've only one child in my example.</p>