AppsFlyerSDK / appsflyer-flutter-plugin

Flutter Plugin for AppsFlyer SDK
MIT License
142 stars 111 forks source link

Deeplinking not working on IOS when continueUserActivity is used #244

Closed omi-gabledesma closed 1 year ago

omi-gabledesma commented 1 year ago

When Open URI-scheme options is used for the deeplinking, it is working fine. Here's the code on AppDelegate.swift (Taken from the documentation)

override func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
    NSLog("AppsFlyer [deep link]: Open URI-scheme options")     
    AppsFlyerAttribution.shared()!.handleOpenUrl(url, options: options)
    return true
}

Here are the logs:

AppsFlyer [deep link]: Open URI-scheme options
[AppsFlyerSDK] [com.apple.main-thread] handleOpenUrl: sampleappzxc://af?af_deeplink=true&af_dp=sampleappzxc%3A%2F%2F&af_force_deeplink=true&af_xp=social&campaign=Test%20Facebook%20Product&deep_link_sub1=UHJvZHVjd%253D&deep_link_value=productId&media_source=Social_facebook&shortlink=mn9knz
[AppsFlyerSDK] [com.appsflyer.serial] Deeplink regex execution time: 0.000109
[AppsFlyerSDK] [com.appsflyer.serial] [HTTP] Operation start: `OneLink-2D1CD0A0-555C-4800-855C-C88705270504`
[AppsFlyerSDK] [com.appsflyer.serial] UniversalLink/Deeplink found:
sampleappzxc://af?af_deeplink=true&af_dp=sampleappzxc%3A%2F%2F&af_force_deeplink=true&af_xp=social&campaign=Test%20Facebook%20Product&deep_link_sub1=UHJvZHVjd%253D&deep_link_value=productId&media_source=Social_facebook&shortlink=mn9knz
[AppsFlyerSDK] [com.appsflyer.serial] [DDL] Calling didResolveDeepLink with: {"af_sub4":null,"click_http_referrer":null,"af_sub1":null,"click_event":{"af_xp":"social","campaign":"Test Facebook Product","af_deeplink":"true","deep_link_sub1":"UHJvZHVjd%3D","af_dp":"sampleappzxc:\/\/","deep_link_value":"productId","media_source":"Social_facebook"},"af_sub3":null,"deep_link_value":"productId","campaign":"Test Facebook Product","match_type":null,"af_sub5":null,"media_source":"Social_facebook","campaign_id":null,"af_sub2":null}

BUT when continueUserActivity is used, the didResolveDeepLink is returning null values: (Code taken from the documentation)

override func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
     NSLog("AppsFlyer [deep link]: continue userActivity")
     AppsFlyerAttribution.shared()!.continueUserActivity(userActivity, restorationHandler:nil )
     return true
}

Sample logs:

AppsFlyer [deep link]: continue userActivity
[AppsFlyerSDK] [com.apple.main-thread] NSUserActivity `webpageURL`: https://click.sampleappzxc.com/DFqZ/mn9knz
[AppsFlyerSDK] [com.appsflyer.serial] Deeplink regex execution time: 0.000056
[AppsFlyerSDK] [com.appsflyer.serial] [HTTP] Operation start: `OneLink-DAFC4813-AEF2-4996-A51B-D59F756AC1FA`
[AppsFlyerSDK] [com.appsflyer.serial] UniversalLink/Deeplink found:
https://click.sampleappzxc.com/DFqZ/mn9knz
[AppsFlyerSDK] [com.appsflyer.serial] [DDL] Calling didResolveDeepLink with: {"af_sub4":null,"click_http_referrer":null,"af_sub1":null,"click_event":{},"af_sub3":null,"deep_link_value":null,"campaign":null,"match_type":null,"af_sub5":null,"media_source":null,"campaign_id":null,"af_sub2":null}

Both scenarios are using the same link. The only difference is the Open URI-scheme options is being triggered when the link is opened from the Facebook Messenger app while the continueUserActivity is being triggered when the link is opened from the Viber app

Meanwhile on Android, all of our deeplinking tests are working fine.

Appsflyder SDK version: 6.8.2 Flutter version: 3.3.9

omi-jrparreno commented 1 year ago

same issue as well

github-actions[bot] commented 1 year ago

👋 Hi @gbrledesma and Thank you for reaching out to us. In order for us to provide optimal support, please submit a ticket to our support team at support@appsflyer.com. When submitting the ticket, please specify:

omi-gabledesma commented 1 year ago

Contacted the appsflyer support and it turns out that I only had to add to set our branded domains: https://github.com/AppsFlyerSDK/appsflyer-flutter-plugin/blob/53440869fd9a7521c14d7f457f49626dc228d858/doc/API.md#setOneLinkCustomDomain

Closing this issue. Thank you