8

Universal Links in iOS9 use the Handoff mechanism to look at a link in an app instead of the browser: Whenever a Universal Link is clicked, iOS activates the corresponding app and calls -application:continueUserActivity:restorationHandler with a user activity containing the Universal Link's URL (see Apple guide on Universal Links).

I'd like to trigger this mechanism manually, i.e. creating an NSUserActivity instance with a webpageURL property and dispatching it to be handled by the current app's -application:continueUserActivity:restorationHandler. Is there a way to achieve this?

At the moment I'm just calling -application:continueUserActivity:restorationHandler directly, but this feels wrong and I'd like to implement it in a more proper way.

severin
  • 10,148
  • 1
  • 39
  • 40
  • Do you need the `application` or `restorationHandler` parameters? If not, you could create a separate method or class to handle the `NSUserActivity`. And then call that method from both `-application:continueUserActivity:restorationHandler` or directly from within your app. The documentation says `It’s important to understand that if your app uses openURL: to open a universal link to your website, the link always opens in Safari instead of getting redirected to your app.` so its unlikely there is a way to directly hit that method from within your app. – Joseph Chen Jan 17 '16 at 00:52

0 Answers0