format error with apple-app-site-association

Hi,


We are having a format error with the apple-app-site-association file, though having followed the docs here.


We've signed and deployed the association file here:

https://m.catchoftheday.com.au/apple-app-site-association

with the original content like:

{

"applinks": {

"apps": [],

"details": [

{

"appID": "_team.our.app.identifier_",

"paths": [ "/event/*/", "/event//product/*/", "/product/*/" ]

}

]

}

}


The search validation tool still says format error:

`The apple-app-site-association file was found but it doesn’t follow the required format.`

though the format is the same as shown in the previous docs.


Could anybody shed some light on this please? Thanks a lot!

Accepted Answer

I’m not 100% sure what you’ve done to create that

apple-app-site-association
file but there’s definitely something wonky about it. In general, I should be able to sign the JSON file in the standard way and then extract it using the
cms
subcommand of the
security
command. For example:
$ # Sign in the standard way.
$
$ openssl smime -sign -nodetach -in unsigned.json -out apple-app-site-association -outform DER -inkey private-key.pem -signer certificate.pem
$
$ # Extract as cms.
$
$ security cms -D -i apple-app-site-association -o extracted.json
$
$ # They're the same!
$
$ cmp unsigned.json extracted.json ; echo $?
0

That doesn’t work in your case:

$ curl -O -s https://m.catchoftheday.com.au/apple-app-site-association
$ security cms -D -i apple-app-site-association -o extracted.json
security: failed to add data to decoder: UNKNOWN (-8183(d)
security: problem decoding

Either you signed the file incorrectly or the data got corrupted when you uploaded it to your server.

The standard approach to signing these files is outlined in WWDC 2015 Session 509 Seamless Linking to Your App. I suggest you re-sign the file then check it locally with

security cms
. Then upload it to your server, download it, and verify that the uploaded and downloaded files are equal.

Share and Enjoy

Quinn "The Eskimo!"
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

thanks eskimo!


we followed your procedure to ensure it's possible to extract the file from the signed one. and it finally worked

thank you very much! 🙂

Dear eskimo, is there a way to execute this command

openssl smime -sign -nodetach -in unsigned.json -out apple-app-site-association -outform DER -inkey private-key.pem -signer certificate.pem


Is there an apple library to execute this? I'm struggling to find it, and I can't.



Thnaks a lot for your time.


Carlos

format error with apple-app-site-association
 
 
Q