Setting Up a Test Server for iOS Deep Linking with Firebase — 2024 Guide

Soner Karaevli
3 min readFeb 17, 2024

--

As you may know, to redirect an application using Universal Links on iOS, we used to add the AASA file to our domain’s .well-known directory. If you don’t have your own server or are using a private server, in this article, you’ll learn how to quickly set up a test server and add the AASA file.

You can access my article on how to implement deep linking in iOS here.

Step 1 — Create a Firebase project ✅

Step 2— Initialize Firebase in your environment ✅

  • Create a folder on the desktop and navigate to that directory.
  • You can execute these commands sequentially in the terminal:

cd desktop

mkdir example

cd example

⚠️ Attention ⚠️ In this step, it is essential to have Firebase CLI installed on your macOS. If you don’t have Firebase CLI, you can install it from here.

  • run firebase init command in your folder path

firebase init

  • Then select the option in the image using the “down” and up “arrow” keys and first “space” then click the “enter” on the keyboard: Hosting: Configure files for Firebase Hosting and (optionally) set up Github Action deploys.
if you select wrong option then run firebase init again
  • Select the “Use an existing” option, and then choose the Firebase project you created earlier from the listed projects.

Then first press Enter, then type yes, and finally type no, just like in the image

  • Then run

firebase deploy

  • go to public folder in your project

cd public

  • create a “.well-known” folder

mkdir .well-known

  • Upload your AASA file to the “.well-known” directory with the name “apple-app-site-association”.

If you can’t see your “.well-known” folder in the public directory, it might be invisible. Press “Command + Shift + .” to reveal the “.well-known” folder.

Step 3— Set The Path And Type For AASA ✅

go to your firebase.json file on your project main directory and replace with this code:

{
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
],
"headers": [
{
"source": "/.well-known/apple-app-site-association",
"headers": [{"key": "Content-Type", "value": "application/json"}]
}
]
}
}

This way, we’ve placed the AASA file in JSON format inside the ‘.well-known’ folder on our server and defined its path

Finally run:

firebase deploy

You can find your hosting URL in terminal:

let’s check our AASA file 🔥🔥🔥

go to “your-domain/.well-known/apple-app-site-association” in your browser

“I hope what I wrote has been helpful. I would be happy if you follow and like. Thank you!🖤

Follow me on github: https://github.com/sonerxdev

--

--