Intermittent Failures Launching App from Universal Links using ASWebAuthenticationSession

I'm developing an iOS app that utilizes Universal Links and ASWebAuthenticationSession to deep-link from a website to the app itself. This implementation adheres to the recommendations outlined in RFC 8252, ensuring that the app opening the ASWebAuthenticationSession is the same app that is launched via the Universal Link.

Problem:  While most users can successfully launch the app via Universal Links,a few percent of users experience instances where the app fails to launch, and the user is redirected to the browser.

What I've Tried:  ASWebAuthenticationSession Configuration: I've double-checked the configuration of callbackURLScheme and presentationContextProvider.  Universal Links: Verified the apple-app-site-association file and associated domains entitlement.  Network Conditions: Tested on various network environments (Wi-Fi, cellular) and devices.

Questions:  What are the potential causes for this behavior?  Has anyone else encountered a similar issue and found a solution?  Are there any debugging techniques or ways to generate more detailed logs?

I haven't been able to determine which device or OS version is causing this problem. Thank you.

Thank you for the post. The Universal Links should always open the app if it is configured correctly and installed on the device. It would be beneficial to find a device where, after installing the app, the browser still opens instead of the app. By examining the sysdiagnose swcutil file, we can identify any errors related to this issue. If you have a device experiencing this problem, you will be able to pinpoint the error.

Can you get one of those devices and extract the swcuilt file?

Given that you are handling the ASWebAuthenticationSession, there could be an issue with authentication. I have a few ideas that may be helpful:

  • App Delegate Methods:
    • Ensure that your app delegate handles Universal Link continuations correctly.
    • Override the necessary methods in your app delegate to handle incoming Universal Links.
  • ASWebAuthenticationSession Completion:
    • Verify that you are handling the completion handler of ASWebAuthenticationSession properly.
    • Make sure to call the completion handler with the appropriate result when the authentication session finishes.

Albert Pascual
  Worldwide Developer Relations.

Thank you for your response. I have rechecked the app's implementation, and it seems there are no issues. Also, we know from the server logs that a bug is occurring, but I am unable to reproduce this bug on my end, so I cannot submit a swcuilt file.

I apologize for the limited information I can provide, but I would be grateful for any hints you could offer to help resolve this issue.

Thank you for your response. This is an intriguing matter. When you mentioned that “we know from the server logs that a bug is occurring,” could you please share the specific details you are observing in the server logs, better yet, can you share those logs? Additionally, have you verified that the AASA file is being synchronized correctly with the Apple servers? If possible, would it be possible to gain access to a device experiencing this issue to inspect the error message generated by the swcutil file or sysdiagnose?

Albert Pascual
  Worldwide Developer Relations.

Thank you for your response. Here is the information we have from the server logs: When app redirection using Universal Links fails, the HTTP link is opened in the browser. We have detected statistics from Google Analytics showing that multiple devices have accessed the relevant page. However, we do not have specific log files at this time.

Since we do not have access to the device, we cannot obtain the logs immediately. However, we will share them as soon as we can retrieve them.

Intermittent Failures Launching App from Universal Links using ASWebAuthenticationSession
 
 
Q