iosdeep-linkingapplinksios-sharesheetassociated-domains

iOS applink not working on the device but opens app on simulator


I tried to follow as many as suggestions as possible but could not get it to work on my app which is still in development (not in appstore yet). Here are the details:

Only testing in iOS 14 for now.

Following JSON file "apple-app-site-association" stored both under Wordpress web root as well as under .well-known/

{
    "applinks": {
        "apps": [],
        "details": [
            {
                "appID": "XXXXXXXXXX.com.xxx.myapp",
                "paths": [
                    "item/*"
                ]
            }
        ]
    }
}

Forcing MIME type with .htaccess

<Files apple-app-site-association>
ForceType application/json
</Files>

curl -v to https://mydomain/.well-known/apple-app-site-association returns content with right mime type application/json and status code 200.

Here is the .entitlements file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>aps-environment</key>
        <string>development</string>
        <key>com.apple.developer.associated-domains</key>
        <array>
                <string>applinks:www.myapp.com</string>
                <string>applinks:www.myapp.com?mode=developer</string>
        </array>
</dict>
</plist>

Enabled Associated Domains Debugging in Settings -> Developer menu.

Added Associated Domains capability in the developer.apple.com portal.

Verified OK with https://branch.io/resources/aasa-validator/

Implemented the delegate methods but not invoked

func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
    print("Opening app thru applink")
    // ....
    return true
}

Server access logs have this line which indicates either Apple Bot or the device accessed it

00.000.00.00 - - [04/Mar/2021:23:05:19 -0700] "GET /.well-known/apple-app-site-association HTTP/1.1" 200 133 "-" "swcd (unknown version) CFNetwork/1220.1 Darwin/20.3.0" **0/507**

Not seeing and swcd errors in device logs related to this.

Tried both debug and release builds.

Anything else I can do to troubleshoot?


Solution

  • Finally figured out. Was missing couple of things:

    1. Paths in the association file must have "/" prefix like "/item/*"
    2. Was using Team ID in the "appID" field , but using App prefix ID helped