Apple-app-site-association is not working

onCompletion picture onCompletion · Oct 7, 2016 · Viewed 12k times · Source

I have implemented apple-app-site-association for deep linking with my iOS app.
I have created the .JSON file without extension and placed to my website's root directory.
Now, I can see the file as https://example.com/apple-app-site-association on any browser.

Following is the json body inside the apple-app-site-association file -

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

FYI I have added following inside my website's(angular.js) .htaccess -

<FilesMatch "^apple-app-site-association$"> ForceType application/json </FilesMatch>

I have already enabled the "Associated Domain" in both Xcode and developer.apple.com.
But, when I am trying to install a new build, its not working.
By digging into the device log, I am getting the following error.

Please take look and assist me about what I am doing wrong.

[SWC] ### Bad apple-app-site-association JSON: Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set." UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}

Answer

bradkratky picture bradkratky · Oct 10, 2016

The file is appropriately hosted, as confirmed by using:

curl -I https://pravin-dev.slicepay.in/apple-app-site-association

You can also use Apple's Applebot to crawl your site to validate an apple-app-site-association. However, this only full verifies if your app is live.

The issue may not be with your association file. You should verify your app is indeed checking https://pravin-dev.slicepay.in/apple-app-site-association and not https://slicepay.in/apple-app-site-association. Double check your applinks in the Associated Domains section of your Capabilities, and the .entitlements file was properly generated. You are using the pravin-dev subdomain - if this was not specified your app may not be looking in the correct location.

As you may know you have to uninstall the app to re-check for the apple-app-site-association.

Ensure capabilities includes subdomain Ensure entitlements file was set properly