Why Are Deeplinks in Push Notifications Not Working on iOS Devices?

Problem

Deeplinks in push notifications are not working on iOS devices.

Solution

Perform the following steps:

  • Deeplinks are a feature in iOS App development that MoEngage supports. To verify whether the deeplink implementation is correct on the developer’s end, ensure the deeplink URL properly redirects and opens the app from a third-party app like WhatsApp, Slack, or a web browser using the same link as in the campaign.
  • If the deeplink fails to work, the issue is likely with the implementation on the developer's end. MoEngage uses native deeplink functions provided by Apple, located in the AppDelegate file.
Swift
//Called from Apple guidelines for normal deeplinks: appName://keyvalues
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) - Bool {
  //Call only if MoEngageAppDelegateProxyEnabled is NO in Info.plist
  MoEngageSDKAnalytics.sharedInstance.processURL(url) //9.xx
  MoEngage.sharedInstance().processURL(url) //8.xx //7.xx
}

//Called from Apple guidelines for Universal Links: https://appdomain.com/keyvalues
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) - Void) - Bool {
  if userActivity.activityType == NSUserActivityTypeBrowsingWeb ,
    let incomingURL = userActivity.webpageURL{
    //Call only if MoEngageAppDelegateProxyEnabled is NO in Info.plist
    MoEngageSDKAnalytics.sharedInstance.processURL(incomingURL) //9.xx
    MoEngage.sharedInstance().processURL(incomingURL) //8.xx //7.xx
  }
  //rest of the implementation
  return true
}

 

Objective-C
//Called from Apple guidelines for normal deeplinks: appName://keyvalues
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<uiapplicationopenurloptionskey,id> *)options {
  
  return  true;
}

//Called from Apple guidelines for Universal Links: https://appdomain.com/keyvalues
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler {
  
  return true;
}

Was this article helpful?
0 out of 0 found this helpful

How can we improve this article?