Adding Universal Links in Next.js 14 – App Not Opening on iOS/Android
Unanswered
North Pacific hake posted this in #help-forum
North Pacific hakeOP
I am trying to add Universal Links in a Next.js 14 project.
I created a .well-known folder inside the public directory and placed the apple-app-site-association and assetlinks.json files inside it.
Additionally, in the next.config.js file, I used the headers method to return the correct headers (Content-Type: application/json) when these files are requested.
However, when clicking on the domain link via Slack, SMS, or other messaging apps, only the web page opens instead of the app.
My testing environment:
The app is already installed before testing.
No NGINX is used.
The issue occurs on both Android and iOS—the app does not open.
Does anyone know what might be causing this issue or how I can fix it?
Any help would be greatly appreciated!
I created a .well-known folder inside the public directory and placed the apple-app-site-association and assetlinks.json files inside it.
Additionally, in the next.config.js file, I used the headers method to return the correct headers (Content-Type: application/json) when these files are requested.
However, when clicking on the domain link via Slack, SMS, or other messaging apps, only the web page opens instead of the app.
My testing environment:
The app is already installed before testing.
No NGINX is used.
The issue occurs on both Android and iOS—the app does not open.
Does anyone know what might be causing this issue or how I can fix it?
Any help would be greatly appreciated!
const nextConfig = {
async headers() {
return [
{
source: "/.well-known/apple-app-site-association",
headers: [
{
key: "Content-Type",
value: "application/json",
},
],
},
{
source: "/.well-known/assetlinks.json",
headers: [
{
key: "Content-Type",
value: "application/json",
},
],
},
];
},
};
3 Replies
you need to tell both android and ios about your domain and everything
this needs to be done inside xcode and
AndroidManifest.xml
North Pacific hakeOP
Everything has been applied correctly according to your suggestions. However, even after setting everything up, when clicking the link, the app does not open even if it is already installed, which is quite frustrating.
If there is a way to debug this issue, that would be really helpful.
If there is a way to debug this issue, that would be really helpful.