1

Where can I upload 'apple-app-site-association' for universal link setup in my iOS app?.

How can I use universal link in my iOS app?. I am getting just confuse to read a lot of tutorials. Can anyone help me?

Pooja Gupta
  • 785
  • 10
  • 22
Pankaj Sonava
  • 519
  • 4
  • 20

1 Answers1

6

You need to upload apple-app-site-association file to the root directory of the server(from where you need to redirect to your installed app).

e.g- Suppose you have to redirect from www.abc.com/getapp then you need to upload the apple-app-site-association file to the root directory where the www.abc.com is get hosted.

Steps to support universal links-

  1. Create your apple-app-site-association file(Suppose your universal link is www.abc.com/getapp and you want to redirect in your app from here).

    {
     "applinks": {
        "apps": [],
        "details": [
            {
                "appID": "9JA89QQLNQ.com.apple.wwdc", //9JA89QQLNQ is your team ID & com.apple.wwdc is your bundle id
                "paths": [ "/getapp"]
            }
        ]
      }
    }
    
  2. Upload this file to the root directory where www.abc.com is hosted.

  3. Validate at http://branch.io/resources/aasa-validator/. If the file is valid then all checks would be green.
  4. Now prepare your app to support universal links-

    a. Go to developer.apple.com and enable Associated Domains to your app ID.

    b. Select your target and turn on Associated Domains switch.

    c. Add applinks:abc.com. enter image description here

    d. Add application:continueUserActivity:restorationHandler: app delegate method so that your app can receive a link and handle it appropriately.

Not getting callback to the app-

1.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. enter image description here

2.Copy and paste your universal link(http(s)://www.abc.com/getapp) to notes and tap on it. It your app can handle this link you will get the option Open in "AppName".

References-

  1. https://gist.github.com/anhar/6d50c023f442fb2437e1
  2. https://developer.apple.com/library/content/documentation/General/Conceptual/AppSearch/UniversalLinks.html

Hope it may help.

Pooja Gupta
  • 785
  • 10
  • 22
  • i did uploaded apple-app-site-association file to server , which i used for backend services like login, signup etc. – Pankaj Sonava Feb 20 '18 at 08:39
  • After then, which url will i use for universal link like my server apple-app-site-association url or my custom domain which i create when turn on the Associated Domain in capability in my project – Pankaj Sonava Feb 20 '18 at 08:42
  • To implement universal links you need a website. When your app isn’t installed, tapping a link to your website opens the content in Safari, as users expect and if the app is installed your app will be opened. – Pooja Gupta Feb 20 '18 at 08:59
  • You can also validate your apple-app-site-association here. https://branch.io/resources/aasa-validator/#resultsbox – Pooja Gupta Feb 20 '18 at 09:03
  • I uploaded apple-app-site-association to my website root directory , then i check apple-app-site-association validate from given link. It shows all green success message. Then which is the my app universal link ? . Please help me i completely got confuse. – Pankaj Sonava Feb 22 '18 at 10:49
  • Thank you sir, Currently i am follow same steps as you mention. – Pankaj Sonava Feb 22 '18 at 12:45
  • But sir one thing i want to know , Should all check would be green when we validate the AASA file ? – Pankaj Sonava Feb 22 '18 at 12:49
  • Yes.. all check will be green and your apple-app-site-association file would be shown if your file is valid and uploaded successfully. You can type facebook.com in the validator and see the results. – Pooja Gupta Feb 22 '18 at 12:52
  • ok sir , But my AASA file one check getting error "Your file's 'content-type' header was not found or was not recognized.". – Pankaj Sonava Feb 22 '18 at 13:00
  • Our site has passed validation at branch.io but it incorrectly indicated a "pass". In fact it still failed the validation at the Apple validator (which gave no useful feedback). The only validator we found that gave truly accurate feedback was here: https://limitless-sierra-4673.herokuapp.com/. – Craig McMahon Sep 15 '20 at 07:07