BranchMetrics / capacitor-branch-deep-links

Capacitor plugin for branch.io deep links
MIT License
32 stars 45 forks source link

Deep Linking Fails with Empty Referring Parameters #143

Closed metinjakupi closed 4 months ago

metinjakupi commented 8 months ago

Describe the bug

  BranchDeepLinks.addListener('init', (event: BranchInitEvent) => {
        alert(JSON.stringify(event.referringParams))

     //referringParams are empty
   })

here is how i generate a shortUrl that contains token

  async generateBranchLink() {
    try {
      let user = await this.storageService.get('user');

      var properties = {
        $match_duration: 2000,
        custom_string: 'data',
        custom_boolean: true,
        $custom_data: JSON.stringify({token: user.share_token}),
      };

      let res = await BranchDeepLinks.generateShortUrl({properties});
      return res.url;
    } catch (err) {
      console.error('Error generating Branch link:', err);
      throw err;
    }
  }

Steps to reproduce

1.Implement capacitor-branch-deep-links as per the documentation 2.Generate a deep link with custom user share token 3.Attempt to open the app through the generated deep link.

Expected behavior

The app opens via the deep link, but all parameters that were appended to the deep link URL are received as empty. This behavior is consistent across different devices and platforms.

SDK Version

7.1.0

Make and Model

Iphone 12 Pro

OS

iOS 17.3.1

Additional Information/Context

No response

qliqdev commented 8 months ago

the same problem on ios only, android works fine

💊   Capacitor Doctor  💊 

Latest Dependencies:

  @capacitor/cli: 5.7.4
  @capacitor/core: 5.7.4
  @capacitor/android: 5.7.4
  @capacitor/ios: 5.7.4

Installed Dependencies:

  @capacitor/cli: 5.7.4
  @capacitor/core: 5.7.4
  @capacitor/android: 5.7.4
  @capacitor/ios: 5.7.4

package.json

"capacitor-branch-deep-links": "^7.1.0",

Debug log

[BranchSDK][Debug][BNCServerInterface preparePostRequest:url:key:retryNumber:] Body: {
    "anon_id" = "3413F720-B88C-4B7E-9AA7-416C23156S9E";
    "app_version" = "3.4.0";
    "apple_testflight" = 1;
    "branch_key" = "key_test_XXXXXXXXXXXXXXXXXXXXX";
    brand = Apple;
    build = 21E236;
    "connection_type" = wifi;
    country = RU;
    "cpu_type" = 16777228;
    debug = 0;
    environment = "FULL_APP";
    "first_install_time" = 1711278759003;
    "hardware_id" = "60DCA66B-7F35-4F10-8A63-C3XX6C4CFC08";
    "hardware_id_type" = "vendor_id";
    "ios_bundle_id" = "xx.xxx.xxxxxxxxx";
    "ios_vendor_id" = "60DCA66B-7F35-4F10-8A63-C3XX6C4CFC08";
    "is_hardware_id_real" = 1;
    language = en;
    "lastest_update_time" = 1711645317000;
    "latest_install_time" = 1711645894308;
    "local_ip" = "xxx.xxx.xxx.xxx";
    locale = "en_001@rg=ruzzzz";
    metadata =     {
        "skan_time_window" = "5184000.000000";
    };
    model = "iPhone13,1";
    "opted_in_status" = "not_determined";
    os = iOS;
    "os_version" = "17.4.1";
    "plugin_name" = Capacitor;
    "plugin_version" = "7.0.0";
    "screen_dpi" = 3;
    "screen_height" = 2436;
    "screen_width" = 1125;
    sdk = "ios3.3.0";
    update = 0;
    "uri_scheme" = xxxxxxxxx;
    "user_agent" = "Mozilla/5.0 (iPhone; CPU iPhone OS 17_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148";
}
qliqdev commented 8 months ago

@metinjakupi have you found solution?

metinjakupi commented 8 months ago

@qliqdev It worked once only, but now it stopped again so i dont know what

echo-branch commented 8 months ago

@metinjakupi Could you open a support ticket for this? https://help.branch.io/using-branch/page/submit-a-ticket

The github issues page has much longer response times than support tickets.

For this particular issue, I suspect there is a configuration issue with the entitlements file. The one time success could have been due to a deferred deeplink rather than correct Universal Link setup.

raghudantuluri commented 7 months ago

For us everything was working fine including deferred deep links using IOS Native Solution until IOS15 but deferred deep linking broke since IOS 16, seeing similar issue, during App install we can see from branch debug log that link is coming through but in the branch init listener which starts listening after App install, referringParams are coming empty

raghudantuluri commented 7 months ago

If I disable Private Relay in my iPhone(iOS 17) , I am getting this allow paste prompt, and after hitting allow deferred deep link is working.

however as per below two blogs from branch, this should have been supported and deferred deep link should work without having to disable private relay?

https://www.branch.io/resources/blog/nativelink-solution-to-challenges-caused-by-ios-15/

https://www.branch.io/resources/blog/everything-you-need-to-know-about-ios-16-and-pasteboard-opt-ins/

Here is what we have from podlock and logs PODS:

And these are the logs I see related to branch from Xcode, still not getting referringparams after install

[BranchSDK][Debug][Branch initializeSessionAndCallCallback:sceneIdentifier:urlString:] Request <BranchInstallRequest: 0x303d0a7a0> callback <NSMallocBlock: 0x302c5d4c0> link (null) [BranchSDK][Debug][BNCServerInterface preparePostRequest:url:key:retryNumber:] <NSMutableURLRequest: 0x303b18310> { URL: https://api3.branch.io/v1/install } Headers { "Content-Length" = 1688; "Content-Type" = "application/json"; } Body { "anon_id" : "719___A41", "app_version" : "._.", "apple_attribution_token" : "____", "apple_testflight" : true, "branch_key" : "key_live____", "brand" : "Apple", "build" : "_", "connection_type" : "wifi", "country" : "US", "cpu_type" : "16777228", "debug" : false, "environment" : "FULL_APP", "first_install_time" : 1703564954000, "hardwareid" : "", "hardware_id_type" : "vendor_id", "ios_bundle_id" : "__", "ios_vendorid" : "____", "is_hardware_id_real" : true, "language" : "en", "lastest_update_time" : 1714138566000, "latest_install_time" : 1714138568219, "local_ip" : "__", "locale" : "en_US", "metadata" : { "skan_timewindow" : "5184000.000000" }, "model" : "", "opted_in_status" : "denied", "os" : "iOS", "os_version" : "17.4.1", "plugin_name" : "Capacitor", "plugin_version" : "7.0.0", "retryNumber" : 0, "screen_dpi" : 3, "screen_height" : 2556, "screen_width" : 1179, "sdk" : "ios3.4.3", "update" : 0, "uri_scheme" : "____", "user_agent" : "Mozilla\/5.0 (iPhone; CPU iPhone OS 17_4_1 like Mac OS X) AppleWebKit\/605.1.15 (KHTML, like Gecko) Mobile\/15E148" } Failed to request allowed query parameters from WebPrivacy.

⚡️ To Native -> BranchDeepLinks addListener 98742127 ⚡️ To Native -> BranchDeepLinks addListener 98742128 [BranchSDK][Debug][BNCServerInterface processServerResponse:data:error:] <NSHTTPURLResponse: 0x303937100> { URL: https://api3.branch.io/v1/install } { Status Code: 200, Headers { "Access-Control-Allow-Origin" = ( "*" ); "Content-Length" = ( 283 ); "Content-Type" = ( "application/json; charset=utf-8" ); Date = ( "Fri, 26 Apr 2024 13:36:17 GMT" ); "Strict-Transport-Security" = ( "max-age=31536000; includeSubDomains" ); Via = ( "1.1 a147f9c60c162e36df3586fdd9c01478.cloudfront.net (CloudFront)" ); "x-amz-cf-id" = ( "gz-==" ); "x-amz-cf-pop" = ( "PHL51-P1" ); "x-branch-request-id" = ( "_____" ); "x-cache" = ( "Miss from cloudfront" ); "x-powered-by" = ( Branch ); } } Body { "data" : "{\"+clicked_branch_link\":false,\"+is_firstsession\":true}", "link" : "https:\/\/.app.link?%24randomized_bundle_token=__", "randomized_bundle_token" : "___", "randomized_devicetoken" : "", "session_id" : "1312399193406720942" } Branch initSession, got params - : ["+clicked_branch_link": 0, "+is_first_session": 1] ⚡️ [log] - APP COMP - initExternalLinks - BranchDeepLinks init got event: {"referringParams":{}}

github-actions[bot] commented 5 months ago

This issue has been automatically marked as stale due to inactivity for 60 days. If this issue is still relevant, please respond with any updates or this issue will be closed in 7 days. If you believe this is a mistake, please comment to let us know. Thank you for your contributions.

github-actions[bot] commented 4 months ago

This issue has been closed due to inactivity. If this issue is still relevant, please reopen it or create a new one. Thank you for your contributions.