iOS Universal Links in Flutter
Asked Answered
H

3

7

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?

Hushaby answered 28/8, 2021 at 16:20 Comment(4)
The server you’re using is HTTP or HTTPS?Homes
@Shahar HTTPS, and confirmed content-type jsonHushaby
Add mode=developer to your project capabilities to bypass apples CDN. You can also generate a sysdiagnose on your device to get the log file wwt.com/article/…Tearoom
@Tearoom thanks for the tip! I added ?mode=developer to my project capabilities and ran the analytics according to the article. My app is not even showing up in the swcutil_show.txt so I'm guessing that means the app isn't even looking for the AASA file? Really dumbfounded as to what I could be missing.Hushaby
U
4

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).

Undersurface answered 5/9, 2021 at 8:51 Comment(2)
It would be worth noting the source of this info; I have not been able to find any reference to this around.Psoas
This worked for me -- didn't see it documented anywhere eitherRockoon
H
1

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).

Homes answered 28/8, 2021 at 16:29 Comment(1)
Tried to increment the version, deleted and reinstalled app, still didn't work :/Hushaby
N
0

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


Add your domains under Associated Domains in Signing & Capabilities

enter image description here

Neoclassicism answered 28/8, 2021 at 17:2 Comment(4)
Yes my apple-app-site-association is hosted at /.well-known/apple-app-site-association. I can actually see my AASA when querying here: app-site-association.cdn-apple.com/a/v1. So I feel like that part must be correctHushaby
@Hushaby Same problem here. Did you ever find a solution?Prajna
@MatthewTrent did you added your domains under Associated Domains in Signing & CapabilitiesNeoclassicism
@RamprasathSelvam Mine just updated now and works, turns out it just took a while even tho Apple had already cached it for it to update :)Prajna

© 2022 - 2024 — McMap. All rights reserved.