Reputation: 609
I have taken care of all the steps provided in apple developer docs regarding universal deeplinking, but its still not working.
What all I have tried.
1- Added associated domain on my appId.(on developer.apple.com)
2- Downloaded new provisioning profiles and using them.
3- Enabled deeplinks in xcode project by providing valid path.
4- Create apple-app-site-association file and added detail just like its mentioned in developer docs.
5- Hosted that file to my server
After that as mentioned in developer docs that on install of app on device it will download that file, which is happening, I can see logs on my server (200 status code for that file)
And it is still not working.
Apart from everything I noticed that on developer docs Below is mentioned.
that apple-app-site-association can be created as plain text file, but it should application/json as MIME type. This is the only thing i am confused at right now. Because when i am checking the MIME type of my current file on server nothing is coming.
Is it the issue? If it is then how do I setup the MIME type of a file ?
If not then please tell me what else I am missing.
Thanks in Advance.
Upvotes: 2
Views: 752
Reputation: 944
If it is then how do I setup the MIME type of a file ?
You can set it in the response from your server.
var aasa = fs.readFileSync(__dirname + '/static/apple-app-site-association');
app.get('/apple-app-site-association', function(req, res, next) {
res.set('Content-Type', 'application/json');
res.status(200).send(aasa);
});
This example is in Express.js and from Branch. The link has a step by step guide which I think would be useful to you.
Upvotes: 1
Reputation: 2828
My intuition is that there is something else at play. application/json
just means that Apple will interpret this file as a JSON object. Here are some of my suggestions:
1) Ensure that your AASA file is formatted correctly and that the appID
matches that of your project's app ID followed by bundle ID like my example. I'd just start with this AASA format and move from there.
{
"applinks":
{
"apps":[],
"details":[
{
"appID":"CXXXXXXXXD.com.deep.linked.Deep-Linked-Dogs",
"paths":["NOT /e/*","*","/"]
}
]
}
}
2) Make sure that your entitlements file is included in your project. This is necessary for downloading the AASA. Ensure that your domains are correct.
3) Check if your phone is running iOS 11.2. This version of iOS is having trouble actually downloading the AASA file sometimes. To solve this you should delete the app, restart your phone, then reinstall it. I recommend using Charles Proxy to check whether the phone is actually downloading the AASA file.
4) Check to see whether you have disabled Universal Links in your app (probably not your issue but check). You can do this by copying the link into the Notes app then long pressing on it to prompt an action sheet. If you see "Open in App name" then you can select that to turn on your Universal Links for that app. If you don't see that then the AASA file was not downloaded or configured properly.
5) Use Branch's iOS SDK for deep linking. It will save you SO MANY HOURS of debugging. They handle the AASA file for you as well as providing the deferred deep linking solution and other edge cases.
Upvotes: 1