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.
//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
}
//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;
}
- If deeplinks from third-party apps are working but not with MoEngage push notifications in all app states, follow the instructions from the appropriate link based on your development framework (React-Native, Flutter, Native iOS), AppDelegate file (Swift, Objective-C), and MoEngage SDK version:
- For projects using React-Native, Objective-C, and MoEngage-iOS-SDK (7.x.x | 8.x.x | 9.x.x) where deeplinks are not working in all app states, refer to How to Avoid Common Push Notification Issues on iOS Devices Using React-Native, Objective-C, and MoEngage-iOS-SDK (Versions 7.x.x , 8.x.x, 9.x.x)?
- For projects using React-Native, Swift, and MoEngage-iOS-SDK (7.x.x | 8.x.x | 9.x.x) where deeplinks are not working in all app states, refer to How to Avoid Common Push Notification Issues on iOS Devices Using React-Native, Swift, and MoEngage-iOS-SDK (Versions 7.x.x , 8.x.x, 9.x.x)?
- For projects using Flutter, Swift, and MoEngage-iOS-SDK (7.x.x | 8.x.x | 9.x.x) where deeplinks are not working in all app states, refer to How to Avoid Common Push Notification Issues on iOS Devices Using Flutter, Swift, and MoEngage-iOS-SDK (Versions 7.x.x , 8.x.x, 9.x.x)?
- For projects using Flutter, Objective-C, and MoEngage-iOS-SDK (7.x.x | 8.x.x | 9.x.x) where deeplinks are not working in all app states, refer to How to Avoid Common Push Notification Issues on iOS Devices Using Flutter, Objective-C, and MoEngage-iOS-SDK (Versions 7.x.x , 8.x.x, 9.x.x)?
- For projects using Native IOS, Swift, and MoEngage-iOS-SDK (7.x.x | 8.x.x | 9.x.x) where deeplinks are not working in all app states, refer to How to Avoid Common Push Notification Issues on iOS Devices Using Native iOS, Swift, and MoEngage-iOS-SDK (Versions 7.x.x , 8.x.x, 9.x.x)?
- For projects using Native IOS, Objective-C, and MoEngage-iOS-SDK (7.x.x | 8.x.x | 9.x.x) where deeplinks are not working in all app states, refer to How to Avoid Common Push Notification Issues on iOS Devices Using Native iOS, Objective-C, and MoEngage-iOS-SDK (Versions 7.x.x , 8.x.x, 9.x.x)?
- If deeplinks are not working only when the app is in a killed state, follow these steps:
- Verify with your development team. There may be custom splash screens implemented for app launch that could override MoEngage's deep-link redirection. If the custom splash screen is set as the rootViewController, it will intercept the redirection before it can take place.
-
Check the callback. In the killed state, verify whether the callback is being received in the deeplink function provided by Apple.
//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; }
-
Examine breakpoints. If breakpoints are hit in any of the above functions, the responsibility for resolving the issue lies with the specific deeplink code used by the developer within that code block.
info Information
This issue often occurs with RCTLinkingManager in React-Native, as documented in their official GitHub repository.