title: Deeplink to ViewController in iOS app only works once after start
body: <p>I'm using the following code to deep link (e.g. from Safari browser) to a specific ViewController in my app:</p>
  
  <pre><code>func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -&gt; Bool{
      if(url.host == nil){
          window?.rootViewController?.performSegueWithIdentifier("DeepLinkSegue", sender: nil)
          print("Push-VC opened!")
          print(window?.rootViewController)
          print(window)
      }
      return true
  }
  </code></pre>
  
  <p>When typing dlapp:// in Safari browser it should open the ViewController with the segue identifier „DeepLinkSegue“. That works fine, the ViewController opens.</p>
  
  <p>But only once after launching the app. When you go to an other VC and try again to open the specific VC with „dlapp://“ just the app opens, not the specific VC. You have to restart the app otherwise it won’t work and just opens the app not the specific VC.</p>
  
  <p>I first thought the function is maybe called only once. But not so because print("DL-VC opened!") always prints. Using the three print() functions in my code outputs this in console:</p>
  
  <pre><code>Push-VC opened!
  Optional(&lt;DeepLinkTest.ViewController: 0x157da1d40&gt;)
  Optional(&lt;UIWindow: 0x157da3830; frame = (0 0; 414 736); autoresize = W+H; gestureRecognizers = &lt;NSArray: 0x157da4a90&gt;; layer = &lt;UIWindowLayer: 0x157da1530&gt;&gt;)
  </code></pre>
  
  <p>You can download the project for reproduce the problem here: <a href="http://www.filedropper.com/deeplinktest_1" rel="nofollow">http://www.filedropper.com/deeplinktest_1</a></p>
  
  <p>Regards,
  David.</p>