iOS Universal Links in Flutter

Viewed 2518

I can't seem to get iOS universal links on my Flutter app working. Here are the steps I have taken to setup universal links:

  • Installed flutter uni_links package

  • Uploaded the following apple-app-site-association (with actual values for Team ID & bundle identifier):

    {
      "applinks": {
       "details": [
            { 
                "appID": "xxxxxxx.com.bundleIdentifier", 
                "paths": [ "*" ], 
                "appIDs": ["xxxxxxx.com.bundleIdentifier"], 
                "components": [ 
                    { "/": "*" } 
                ] 
            }
       ]
    }}
    
    
  • Validated apple-app-site-association file via https://branch.io/resources/aasa-validator/ (worth noting that I was not able to validate with Apple's appsearch-validation-tool - received error: "Could not extract required information for Universal Links.")

  • Added the associated domain in my project capabilities: screenshot from xcode

Opening with /usr/bin/xcrun simctl openurl or clicking on the url on my mobile device (tried from notes app) still opens the url in safari instead of opening the app.

What could I be missing?

3 Answers

The device reads the AASA file only when the app’s version changes, try to change the version / use another device (/simulator of another device).

Another thing to check is if the associated domain is actually getting rolled into the build. This setting is in Xcode under Runner => Build Phases => Copy Bundle Resources. Hit the "+" button and add the .entitlements if it is missing. screenshot of xcode

(I don't remember where I came across this suggestion, whether stack overflow or a github issue, but will add it if I come across it again/remember it).

Your apple-app-site-association will be hosted will be root or .wellknown path

your content will be look like below,

{
  "applinks": {
  "apps": [],
  "details": [
        { 
            "appID": "xxxxxxx.com.bundleIdentifier", 
            "paths": [ "*" ] 
        },
        {
            "appID": ["xxxxxxx.com.bundleIdentifier"], 
            "paths": [ "*" ]
        } 
   ]
}}

Your file will be accessible and visible like below
https://google.com/apple-app-site-association
https://example-your-domain.com/apple-app-site-association

Your apple-app-site-association file doesn't contains any extension.
Set content type based on your config => https://gist.github.com/anhar/6d50c023f442fb2437e1#-modifying-the-content-type-of-the-apple-app-site-association-file

Related