0

I have my apple-app-site-association uploaded correctly on the server. It's formatted as follows:

{
    "activitycontinuation": {
      "apps": [
        "ASDF.com.company.appname"
      ]
    },
    "applinks": {
        "apps": [],
        "details": [
            {
                "appID": "ASDF.com.company.appname",
                "paths": [ "/menu/*", "/menu/*/*", "/account/history", "/"]
            }
        ]
    }
}

My entitlements is set up correctly:

applinks:company-site.com
activitycontinuation:company-site.com

I've verified with Charles proxy on install the device fetches the correct file from the server.

When looking at the device log, I get the following error:

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

I've ran the JSON through a linter and it came out fine. The server sends back Content-Type: application/json in the header. I'm testing on a physical device. I've tried typing the URLs manually in safari and clicking them through a text message. Does anyone see where the problem is?

Chris
  • 7,270
  • 19
  • 66
  • 110

1 Answers1

0

I believe the first section of your apple-app-site-association is unnecessary and may be causing the validation error (Apple is pretty strict about this file). I haven't seen this in any other places — is there a particular reason you're including it?

Try this and see if it works better:

{
    "applinks": {
        "apps": [],
        "details": [
            {
                "appID": "ASDF.com.company.appname",
                "paths": [ "/menu/*", "/menu/*/*", "/account/history", "/"]
            }
        ]
    }
}

Also note that Universal Links will never work when entered manually into Safari. See here for more info.

Alex Bauer
  • 13,147
  • 1
  • 27
  • 44
  • I'm including `activitycontinuation` based on what I read from https://medium.com/@barsh/my-first-date-with-ios-universal-links-90dfabc88bb8#.hj4xnlqqn – Chris May 24 '16 at 00:21
  • Hmm. I'm not sure what that author experienced, but I can tell you after doing several thousand Universal Links implementations at Branch.io, we've never needed to use this extra code. Could be it was a problem last October when the guide was written, but definitely not now. Since Apple's official docs don't include that requirement, I still suggest taking those lines out and trying again :) – Alex Bauer May 24 '16 at 02:05
  • So, I'm doing this for my company. When I was waiting for the server guys to upload the file, I made a sandbox app and followed the same steps with my personal server. I had everything set up correctly with the file having only the applinks section. Didn't work. I changed the file to include the acticitycontinuation section and suddenly it worked. – Chris May 24 '16 at 11:28
  • Digging a bit more on that original error message suggests that there may be some very subtle error (i.e., a single wrongly-encoded character or something) with the JSON you're using. That might be a place to start investigations – Alex Bauer May 24 '16 at 15:13