4

I've been using React Native & Branch.io successfully for awhile and it's great. However, I would like to be able to handle non-Branch deeplinks as well. For instance, if my domain name is https://example.com, I'd like my app to be opened when opening, say, https://example.com/my-items. I've been trying to make it work with no luck. I read many, many GitHub issues and SO questions. To repeat, https://example.app.link (i.e. Branch urls/universal links) work without any issues.

Basically, when I click on https://example.com/my-items , my website opens in Safari. The "Open with XYZ" iOS modal does not show up, and I am not taken to the app.

Here's what I've already tried:

0) Went through https://facebook.github.io/react-native/docs/linking and https://hackernoon.com/react-native-deep-linking-for-ios-and-android-d33abfba7ef3

1) Made sure I serve https://example.com/apple-app-site-association (and verified it with https://branch.io/resources/aasa-validator/ ) as JSON and is publicly available.

2) XCode -> Capabilities -> Associated domains

2.1) I also tried with app.link associated d

3) For the sake of debugging, I even made the following in AppDelegate.m (normally I check via [RCTLinkingManager application:application openURL:url options:options] etc)

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
  return YES;
}

- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity
 restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler
{
  return YES;
}

4) I tried on the device itself (using iMessages, Notes, Safari). I also turned off remote debugging (as noted here)

Relevant versions:

XCode: Version 10.2.1 (10E1001)

iOS: 12.4.1

react-native: 0.60.5

react-native-branch: 3.0.0^

https://example.com/apple-app-site-association

{
  "applinks": {
    "apps": [],
    "details": [
      {
        "appID": "<MyTeamID-censored>.<My-Bundle-Identifier-censored>", 
        "paths": [
          "/verify-email*",
          "/notifications/borrower-request*",
          "/notifications/request-confirmed*",
          "/messages/*",
          "/verification",
          "/my-items",
          "/my-rentals",
          "/dashboard*"
        ]
      }
    ]
  }
}
kolistivra
  • 4,229
  • 9
  • 45
  • 58
  • Can you post the appDelegate's continueUserActivity.restorationHandler method ? I implemented this functionality recently and universal links work for me. I can help, if not resolved yet. Also can you share your website url? – Kaushik Oct 11 '19 at 06:18
  • @Kaushik how did you fixed this issue? – allo Mar 04 '21 at 10:34
  • I am having the same problem. But I noticed that if I copied the "apple-app-site-association" to a static site all work perfectly. It seems some sort of configuration needs to happen with React. Any idea what we have to do? – Janaka Oct 05 '21 at 09:47

3 Answers3

1

In Debug mode it not worked for me as well

Try to change build configuration to release(or other if you have) it should work then

Also you can validate your ASAA file online

  • This is what worked for me. Looks like it does not work in debug mode. Go to Product -> Schema -> Edit Schema -> And switch run config to Release to test this out without having to ship it to Testflight – Grant Singleton Aug 09 '22 at 21:48
0

Is this relevant to your use case? It helped me.

When a user is browsing your website in Safari and they tap a universal link to a URL in the same domain as the current webpage, iOS respects the user’s most likely intent and opens the link in Safari. If the user taps a universal link to a URL in a different domain, iOS opens the link in your app.

source

Tim
  • 11
  • 1
0

If you just want to use links with your own domain, then you can change your Branch app.link domain to your own custom domain from Link Settings.