iOS: apple universal link if app is not open?
<p>My app can successfully handle apple universal links, if the app is already open (backgrounded). But if the app is not open already, then when I tap such a link in, say, mail, the app opens, but I never get the callback for application:continueUserActivity... (which I do if the app was already open/backgrounded)...</p>

<p>To wit:</p>

<p>If the app is backgrounded, and I click on an apple universal link in, say, the mail app, then this method (which is what apple's documentation says to implement to handle universal links):</p>

<pre><code>optional func application(_ application: UIApplication,
     continueUserActivity userActivity: NSUserActivity,
       restorationHandler restorationHandler: ([AnyObject]?) -&gt; Void) -&gt; Bool
</code></pre>

<p>Gets called. If the app is not running (I force close it), then when I click on the link, that method does NOT get called, but the app DOES open.</p>

<p>Is this supposed to work this way?</p>

<hr>

<p>Based MCMatan's clue, you have to do something like this in didFinishLaunchingWithOptions, and then continueUserActivity will get called:</p>

<pre><code>if let userActivityDict = launchOptions?[UIApplicationLaunchOptionsUserActivityDictionaryKey] as? NSDictionary,
      activityType = userActivityDict[UIApplicationLaunchOptionsUserActivityTypeKey] as? String where activityType == NSUserActivityTypeBrowsingWeb {

    return true
}
</code></pre>