Universal Link / AppLinks not opening the app

I am struggling getting universal links/applinks working for an App Store Event. I have been through the docs and various troubleshooting methods a number of times and cannot figure out why the universal link is not opening the app.

Here's the apple-app-site-association file we have hosted on our website in .well-known (full url https://binaryformations.com/.well-known/apple-app-site-association):

{
  "applinks": {
        "details": [{
            "appIDs": ["com.BinaryFormations.UnderMyRoof"],
            "components": [{
                "/": "/umrappevent/*",
                "comment": "Matches any URL whose path starts with /umrappevent/"
            }]
        }]
    }
}

Here's the configuration in the Associated Domains section in Xcode:

I've also implemented scene(_ scene: UIScene, continue userActivity: NSUserActivity) in the window scene delegate.

Just to see if it might solve the problem, I also implemented application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([any UIUserActivityRestoring]?) -> Void) -> Bool in the application delegate.

I've been testing with this URL, among others, and the app is not being opened:

https://binaryformations.com/umrappevent/9999

I've tried every troubleshooting technique I could find, including the once mentioned in TN3155 on debugging universal links (https://developer.apple.com/documentation/technotes/tn3155-debugging-universal-links) and everything seems to be as it should. Here's a summary of what I've tried so far:

Checked that the CDN was returning the correct apple-app-site-association file:

https://app-site-association.cdn-apple.com/a/v1/binaryformations.com

Ran the following test with curl to verify there are no redirects (it returned with the response code of 200):

curl -v https://binaryformations.com/.well-known/apple-app-site-association

Using the above mentioned apple-app-site-association file as test.json, I randomly this test using swcutil and the URL seems to match fine:

sudo swcutil verify  -d binaryformations.com -j test.json -u https://binaryformations.com/umrappevent/9999

{ s = applinks, a = com.BinaryFormations.UnderMyRoof, d = binaryformations.com }: Pattern "https://binaryformations.com/umrappevent/9999" matched.

Associated Domains Development Diagnostics on the phone seem to indicate everything is okay with the URL:

Last one: after installing a build from TestFlight on an iPhone (iOS 18), I see this in the swcutil_show.txt file from a sysdiagnose after trying the following link:

https://binaryformations.com/umrappevent/9999

Service:              applinks
App ID:               G52SXV33MH.com.BinaryFormations.UnderMyRoof
App Version:          20240910.0
App PI:               <LSPersistentIdentifier 0x4f8026100> { v = 0, t = 0x8, u = 0x474, db = 52D70E5E-2E19-4D2C-ADA7-1E6154CA1AFA, {length = 8, bytes = 0x7404000000000000} }
Domain:               binaryformations.com
User Approval:        unspecified
Site/Fmwk Approval:   denied
Flags:                
Last Checked:         2024-09-11 15:36:17 +0000
Next Check:           2024-09-16 15:17:08 +0000

I'm sure I'm doing something silly that I just keep overlooking, but cannot seem to figure it out. Is there anything that's jumping out from all of this that I'm missing? Is there any way to get more information from the diagnostics as to why the rule was denied or anything else I should try?

Thank you in advance.

Answered by Enderlyn in 804379022

I went over everything again and noticed that my developer Team ID was prepended to the app's bundle id for the denial entry in swcutil_show.txt.

The documentation (https://developer.apple.com/documentation/xcode/supporting-associated-domains) says the appIDs entry should be in the form of <Application Identifier Prefix>.<Bundle Identifier>. I'd assumed Application Identifier Prefix was the Apple ID of the app as I've seen these used interchangeably before. Anyway, I added the Team ID as a prefix and all is working.

Not sure if this is an error in the documentation or if app's Apple ID is used in production. As a hedge I added both variants (prefixed by Team ID and prefixed by App ID) to the appIDs entry.

Thank you for your comprehensive guide! Your attention to detail in server setup and configuration settings is truly appreciated. To further assist, there's one aspect I think you might haven't mentioned yet, which could be relevant and I see only the domain but not a screenshot. https://developer.apple.com/documentation/xcode/supporting-associated-domains

My apologies if you already set it up.

Xcode Associate Domains Configuration: Have you set up Xcode Associated Domains in your project settings? This feature is essential for establishing a secure and authentic connection between your server and your Xcode project.

To check or set up Associated Domains, follow these steps:

  1. Select your Xcode project file in Xcode.
  2. Go to the General tab.
  3. Look for the section called "App Identifier" near the top.
  4. If you haven't already set it up, click the '+' button next to "Associated Domains."
  5. Create a wildcard domain identifier (e.g., ' .yourdoamain.com')* and add your domain there (replace yourdoamain.com with your actual domain name).

Ensure that your server settings and Xcode Associate Domains configurations match.

If you have already set up Associate Domains but the issue persists, I'd be more than happy to help you review your configurations step-by-step. Let's break it down, and we'll get this resolved!

I'd like you to submit a code-level support request so we can discuss this further privately. When you create the request, indicate that you were referred by someone at Apple and make sure to include a link to this thread.

Albert Pascual 
 Worldwide Developer Relations.

Accepted Answer

I went over everything again and noticed that my developer Team ID was prepended to the app's bundle id for the denial entry in swcutil_show.txt.

The documentation (https://developer.apple.com/documentation/xcode/supporting-associated-domains) says the appIDs entry should be in the form of <Application Identifier Prefix>.<Bundle Identifier>. I'd assumed Application Identifier Prefix was the Apple ID of the app as I've seen these used interchangeably before. Anyway, I added the Team ID as a prefix and all is working.

Not sure if this is an error in the documentation or if app's Apple ID is used in production. As a hedge I added both variants (prefixed by Team ID and prefixed by App ID) to the appIDs entry.

Universal Link / AppLinks not opening the app
 
 
Q