Apple-App-Site-Association Is Not Working

Apple-app-site-association file not linking to application

Make sure you are following these steps

  1. Enabled Associated Domains in the app App services from the developer.apple.com
  2. Set the domain name correctly in the Associated Domains in the Xcode capabilities and also enabled this.
  3. You have correctly generated the apple-app-site-association file. The file must not have any extension. Here is the format for the file:
{
"applinks": {
"apps": [],
"details": [{
"appID": “{app_prefix}.{your_app_bundle_identifier}”,
"paths": ["*"]
}]
}
}

Make sure apps tag in the file is be empty and appID is made up of your app Prefix and bundle identifier separated by.

NOTE: I don't know why but I am using app prefix instead teamID as mentioned in most of the posts and even on the apple documentation. But it didn't work for me.

You can also try by using app prefix of the app id instead of teamID

Apple App Site Association not working if app is not installed

What you are looking for is a Smart banner.

To get this to appear you need to add some meta data to your web page.

<meta name="apple-itunes-app" content="app-id=myAppStoreID, app-argument=myURL">

There are two different processes at work in what you are trying to achieve:

  • When you install an app with an associated domains entitlement, iOS fetches the ASAA file from that domain and then uses that to direct requests to your app for matching URLs
  • When you don't yet have the app installed, Safari uses the meta data to offer the app to the user. Safari does not check every single domain that the user accesses for an ASAA file, so without the meta data you won't get the smart banner.

iOS Universal Links are not opening in-app

There are a few possible issues.

  1. Try pasting your domain into this link validator and make sure there are no issues: https://limitless-sierra-4673.herokuapp.com/ (credit to ShortStuffSushi -- see repo)

  2. iOS logs an error message in the system logs if you don't have TLS set up properly on the domain specified in your entitlements. It's buried in the OS logs, not application logs. The error message will look like Sep 21 14:27:01 Derricks-iPhone swcd[2044] <Notice>: 2015-09-21 02:27:01.878907 PM [SWC] ### Rejecting URL 'https://examplecustomdomain.com/apple-app-site-association' for auth method 'NSURLAuthenticationMethodServerTrust': -6754/0xFFFFE59E kAuthenticationErr. Error message pulled from here, quick (incomplete) instructions on using CloudFlare for TLS here.

  3. In my personal testing, clicking/typing in a link in Safari has never once opened the app directly. Clicking from other apps (iMessage, Mail, Slack, etc.) has worked. Others have reported that clicking links in Google search results have opened the app directly.

  4. Note that if a Universal Link succeeds in opening your app and then you click through to Safari (by tapping your site in the top right corner of the nav bar in app), then iOS stops opening the app when you visit that URL. Then in Safari, you can pull down to reveal a banner at the top of the page with "Open". I wasted a lot of time on this. Note that clicking through to the site => disabling UL seems path specific, based on the paths you specify in the apple-app-site-assocation file. So if you have separate routes, yoursite.com/a/* and yoursite.com/b/*, if you click yoursite.com/a/* and it opens your app directly, you then have the option in the top right corner of the app to click through to yoursite.com/a/*. If you do that, subsequent visits to yoursite.com/a/* will open in browser, not app. However, yoursite.com/b/* should be unaffected and still open your app directly.

Let me know if you discover what the issue is. I'm personally very curious about how Universal Links work and what edge cases exist. Good luck.

Apple app site association not working over AWS CloudFront and S3

I finally managed to get it working. I did 4 different things, I think only 2 of them are important but I'll post them all here in case it helps someone with the same issue.

1: Use my iPhone Developer ID instead of my Team ID (important)

As I was debugging the app on dev environment, the app is signed with my iPhone Developer certificate, not my team's production certificate. So I changed my apple-app-site-association file from

{
"webcredentials": {
"apps": [ "TeamID.BundleId1",
"TeamID.BundleId2" ]
}
}

to

{
"webcredentials": {
"apps": [ "TeamID.BundleId1",
"TeamID.BundleId2",
"iPhoneDeveloperID.BundleId1",
"iPhoneDeveloperID.BundleId2" ]
}
}

2: Invalidate AWS CloudFront cache before testing (important)

While testing, I eventually found out that I was sometimes getting an old version of my apple-app-site-association, depending on which device or software application I was using to fetch it.
So I logged in to the CF console, selected my distribution, selected the Invalidations tab, and created an Invalidation with Object Path /.well-known/apple-app-site-association.

3: Add App Links

I'm not sure whether that made any difference for my issue, as I only invalidated the cache after I tried this, but just in case it helps someone, I decided to add App Links to my app. I added the following object after webcredentials in my apple-app-site-association

"applinks": {
"apps": [],
"details": [
{
"appID": "iPhoneDeveloperID.BundleId1",
"paths": [ "*"]
},
{
"appID": "iPhoneDeveloperID.BundleId2",
"paths": [ "*" ]
},
{
"appID": "TeamID.BundleId1",
"paths": [ "*"]
},
{
"appID": "TeamID.BundleId2",
"paths": [ "*" ]
}
]
}

Make sure the app you're testing is at the top, as the others will get discarded (the first wildcard wins). This must obviously be changed before going to production.

And I added the following entitlement to my app

<string>applinks:example.com</string>

4: Only use .well-known

Again, I don't believe this is important, but instead of having to upload my file twice for each test, I stopped using the root directory, and only uploaded to /.well-known/apple-app-site-association



Related Topics



Leave a reply



Submit