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. If the app is not installed, it falls back to a web page.

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

3. Implementation Steps: Successful implementation involves enabling associated domains in Xcode, creating the AASA file, and hosting it at the root of your domain. The file must meet specific requirements, such as using HTTPS and having no file extension.

4. Debugging Techniques: If Universal Links are not working as expected, troubleshooting steps include checking the 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. For example, if your domain is xyz.com, the path to the AASA file would be xyz.com/apple-app-site-association. Even though it’s a JSON file, it should not appear in the path. Simply use your domain, followed by a slash and “apple-app-site-association.

Once you host the AASA on your server, here’s how it works: When the user installs the app, the AASA is downloaded and cached. The download path is identified by the domains mentioned in the associated domain section. Ensure that your website uses a secure HTTPS connection, as it won’t work with HTTP. The AASA file should be hosted at the root, without any suffixes like JSON, PHP, or ASPX. It should not exceed 128 KB in size, and the MIME type must be application/json.

Once everything is in place, your Universal Link should work when the user taps a link not excluded in your AASA. Your app will launch, and you will receive a user activity object, which contains the URL, in the delegate methods of the App Delegate. You can then parse the URL 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 provide a seamless way to connect web content directly to your iOS app, enhancing the user experience. Users can bypass the web browser, improving convenience. By implementing Universal Links through an Apple App Site Association (AASA) file and configuring your app with associated domains, you 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

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.