Skip to content

Instantly share code, notes, and snippets.

@dpolivy
Created February 26, 2016 01:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dpolivy/b181d881c0137d98be57 to your computer and use it in GitHub Desktop.
Save dpolivy/b181d881c0137d98be57 to your computer and use it in GitHub Desktop.
Implementation of delegate method for implementing Universal Links in iOS 9
/**
* Handle Universal Links
*/
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler
{
// Check if this is a Universal Link
if (![userActivity.activityType isEqualToString:NSUserActivityTypeBrowsingWeb] || userActivity.webpageURL == nil) {
// Not a Universal Link, so not handled
return NO;
}
// Send out the notification
[[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginHandleOpenURLNotification object:userActivity.webpageURL]];
return YES;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment