简体   繁体   中英

Adding associated domains programmatically

I've got a single native mobile app for my clients that have the backend installed on their own servers.

When a client sign up on the mobile app they must write user, password and the url of the server. Sometimes the backend send mails with links and I want to implement Deep Links (Android) and Universal Links (iOS).

Android was easy because I can use wildcard character on the intent-filter, but this is not possible on iOS and I can't have a giant list of domains on com.apple.developer.associated-domains entitlement.

So, on iOS app side I want to add an associated domain to the entitlement list when the user sign up and write the server url. Is this possible? or the only way to associate domains is before compilation? Are there alternative solutions?

Unfortunately, Universal Links are only meant to associate your app with your website (more of a one to one relationship) so they don't provide much functionality to add domains programmatically.

I recommend using URI scheme redirect on those links since you are fairly certain that the user already has the app installed. Add this to the header of the associated link that you would like to have deep link. This will show an error message if the app is not installed . Branch has a solution for this error message.

<head>
  <script type="text/javascript">
    var userAgent = window.navigator.userAgent;
    if (userAgent.match(/iPad/i) || userAgent.match(/iPhone/i)) {
      window.location = "youriosapp://"
    }
  </script>
</head>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM