Universal Links and Apple App Site Association (AASA) - Implementation & Debugging

You may have noticed that sometimes clicking on a URL opens the app, while at other times it directs you to Safari, landing on the web page for that URL. So why is there this difference? What determines when the app should open and when the user should be taken to the browser? Essentially, apps that handle redirection use Universal Links to deep link users into the app. If the app isn’t installed, the same URL will open in a browser. Since this URL works with both the app and the browser, it’s crucial to implement Universal Links AASA Implementation to provide a seamless experience for your users.

Key Takeaways on Universal Links and AASA Implementation

1. Understanding Universal Links: Universal Links enable seamless deep linking, allowing users to navigate directly to content in an app or fallback to a web page if the app is not installed.

2. Role of AASA: The Apple App Site Association (AASA) file is crucial for configuring Universal Links, specifying which URLs should open in the app and which should be directed to a browser.

3. Implementation Steps: Successful implementation involves enabling associated domains in Xcode, creating and hosting the AASA file at the root of your domain, and ensuring it meets specific requirements (e.g., HTTPS, no file extension).

4. Debugging Techniques: If Universal Links are not functioning as expected, troubleshooting may include checking AASA file syntax, verifying domain associations, and ensuring the app is properly configured in Xcode.

5. User Experience Benefits: Properly implemented Universal Links enhance user experience by providing direct access to app content, reducing friction, and avoiding unnecessary redirects.

6. Analytics and Tracking: Integrating analytics allows developers to monitor user interactions with Universal Links, providing insights that can inform future improvements and marketing strategies.

7. Security Considerations: Using HTTPS for AASA hosting and ensuring proper validation helps secure communications between the app and the web, enhancing overall app security.

What Are Universal Links?

For example, if you bought a product from Amazon and you got a confirmation message with a “track order” link say SMS or WhatsApp now if the user has having Amazon app installed you would like to open the app but if the app is not installed you don’t want to change the link you want the same link to work on browser that is where something called AASA comes in.

The Role of AASA (Apple App Site Association)

Website association or AASA is a way through which you can deep link the user into the app using URLs of your webpages, essentially it is a JSON that will look like this.

In this JSON you mentioned which URL should deep link to the app and which one should be opened in the browser. Now let’s look at how we set up AASA and Universal link.

Let’s look at how we set up AASA or Universal Link.
1: First enable the associated domain for your app identifier.
2: Go to Xcode and add the associated domain under the signing and capabilities. 

Understanding the AASA File Structure

Mention your domain and subdomain here and prefix them with the app links colon. This will tell you that your app should download that JSON which we call AASA file. If you have not done this before you would be thinking, how will the app come to know from where it should download the JSON? What is the path for AASA for this apple has made it really easy by setting up some rules?

The AASA file should be hosted at the root which means that if your domain is xyz.com then the path of the AASA would be XYZ.com/apple-app-site-association. Although it is a JSON that shouldn’t be in your path, simply your domain should be followed by slash and apple hyphen app hyphen site hyphen association.

Once you host AASA in your server this is how it works when the user installs the app AASA is downloaded and cached. The download path is identified by the domains mentioned in the associated domain section so make sure that your website where AASA is hosted it uses a secure connection that is https it won’t work with http, so it should be hosted over https, it should be at root any suffix like Json PHP aspx anything like that shouldn’t be there, size shouldn’t be more than 128 KB and the MIME type should be application JSON. 

Once all this is in place your universal link should work when the user taps on the link that is not excluded in your AASA, your app will be launched and you will receive a user activity object essentially the URL in the delegates methods in app delegate which you can then parse and deep link to the Intended screen.

This is how the code looks like:-

Key Components

AASA File

  • A JSON file hosted on your website.
  • Format:

appID: The combination of your Team ID and your app’s bundle identifier.

paths: Specifies which paths should be handled by your app.

You need to host this file at https://yourdomain.com/apple-app-site-association. It should be served with the application/json content type and without a file extension.

App Configuration

Enable Associated Domains:

  • In your Xcode project, go to your app’s target, select the “Signing & Capabilities” tab, and add the “Associated Domains” capability.
  • Add the domain you want to associate, using the format: applinks:yourdomain.com.

Sample Code to Handle Universal Links: In your AppDelegate or SceneDelegate, implement the following method to handle the incoming Universal Link:

Advantages of Universal Links

  1. Seamless User Experience:
    • Users can navigate directly to specific content in the app from a link, eliminating the need to search within the app.
  2. No App Store Interruption:
    • If the app is not installed, the link opens in Safari instead of prompting the user to download the app, providing a smoother fallback experience.
  3. Improved Engagement:
    • Direct linking encourages users to engage more with your app, as they can access content instantly.
  4. Better Analytics:
    • Universal Links can be tracked to analyze user behavior and the effectiveness of marketing campaigns, giving insights into how users interact with your content.
  5. Consistency Across Platforms:
    • Universal Links work similarly across both iOS and web platforms, making it easier to maintain consistent branding and user experience.

Advantages of AASA File

  1. App Verification:
    • The AASA file verifies that the domain is owned by the app developer, ensuring that only legitimate apps can handle specific links.
  2. Flexible Path Management:
    • Developers can specify which URLs should open the app and which should open in a browser, allowing for granular control over user navigation.
  3. Support for Multiple Apps:
    • The AASA file can include configurations for multiple apps under the same domain, simplifying management.
  4. Easy Updates:
    • Changes to paths or app configurations can be made directly in the AASA file without needing to update the app itself.
  5. Improved Security:
    • By using HTTPS and requiring the AASA file, Universal Links help ensure secure communications between the app and the web.

How HashStudioz Enhances Your App with Universal Links Integration

At HashStudioz, we specialize in mobile app development, with a strong emphasis on integrating Universal Links to create seamless user experiences. Here’s how we can assist you:

1. Custom App Development
Our experienced developers will work closely with you to design and build a custom iOS application that meets your specific needs. We ensure that Universal Links are seamlessly integrated, allowing users to navigate directly to relevant content within the app.

2. Expertise in Universal Links
Our team has in-depth knowledge of Universal Links and the Apple App Site Association (AASA) implementation. We will guide you through the entire process, from creating the necessary AASA file to configuring your app for optimal performance.

3. Enhanced User Experience
By implementing Universal Links, we enable your app to provide users with a direct path to content, reducing friction and improving engagement. Our focus is on creating an intuitive and user-friendly interface that enhances overall satisfaction.

4. Thorough Testing and Debugging
We conduct comprehensive testing to ensure that Universal Links function as intended. Our team will troubleshoot any issues that arise during development, ensuring a smooth user experience from the moment the app is launched.

5. Ongoing Support and Maintenance
After the launch, we provide ongoing support to help you maintain and update your app as needed. This includes making adjustments to Universal Links configurations and ensuring compatibility with future iOS updates.

6. Analytics and Performance Tracking
We will integrate analytics tools to track user interactions with Universal Links, providing valuable insights into user behavior and engagement. This data helps you make informed decisions to enhance your app further.

7. Security Compliance
Our development process adheres to the highest security standards. We ensure that your AASA file is hosted securely and that all connections are compliant with HTTPS requirements.

By choosing HashStudioz for your mobile app development needs, you can be confident that your app will not only look great but also deliver a seamless and engaging experience for your users through the effective use of Universal Links. Let us help you elevate your app to the next level!

Conclusion

Universal Links provides a seamless way to connect web content directly to your iOS app, enhancing user experience by allowing users to bypass the web browser. By properly implementing Universal Links through the creation of an Apple App Site Association (AASA) file and configuring your app with associated domains, you can ensure that relevant links open your app instead of Safari.

This integration not only simplifies navigation but also increases user engagement, as users can access app-specific content effortlessly. Understanding the mechanics behind Universal Links—how the AASA file, app configuration, and URL handling work together—empowers developers to create more intuitive and user-friendly applications.

By following the outlined steps and leveraging available resources, you can effectively implement Universal Links in your iOS apps, driving greater connectivity between web and app experiences. If you encounter challenges, consulting Apple’s documentation and community resources can provide valuable insights and solutions.

conclusion.png_1715581349988-removebg-preview (1)

Stay in the Loop with HashStudioz Blog

Ashish Painuly

By Ashish Painuly

Hello, readers! I’m Ashish Painuly, a Senior Software Engineer at HashStudioz Technologies, and I’m excited to share my insights on the evolving landscape of technology and its impact on our business.