Universal links on macCatalyst not working

Viewed 255

I have a correctly working universal link integration on iOS. If I tap the link in iOS Notes.app, then it opens the application and calls the scene(_ scene: UIScene, continue userActivity: NSUserActivity) method. However, the same setup is not working if I run the app as a macCatalyst app.

Checked with the Branch.io AASA validator and swcd Console.app logs, that the Apple App Site Associations file is correctly downloaded. On iOS the correct entries are showing up in the System Diagnosicts/swcutil_show.txt file, on macCatalyst the download happens, but the swcutil_show.txt is empty.

I also watched the WWDC session regarding macOS universal link and tested accordingly (DeveloperID signed build launched first).

Is there any special treatment needed for a macCatalyst app? (Entitlement, AASA JSON format change)?

Thank you in advance for any pointer on how to get to the bottom of this!

1 Answers

I spent a long time trying to debug this, and it turns out (at least for me) it actually "works as expected".

The key point here is that Safari has to be your default browser on macOS. You can change this in the System Preferences -> General -> Default web browser. With Safari as your default browser, clicking on a Universal Link for the first time will open Safari, but show a banner underneath the address field that gives you the option to open the corresponding app directly. If you select this option, all subsequent clicks on the Universal Link will go straight to opening the app. At this point, even changing back your browser to a non-Safari one seems to keep the links connected to your app.

The System Diagnosicts/swcutil_show.txt file being empty seems to be a red herring. This file always ends up being empty for me, even if Universal Links are working correctly as described above.

Last observation, with your default browser set to something other than Safari, you should also be able to open the corresponding app by right-clicking on the link, and choosing Open With -> Your App. Unfortunately this selection is not saved as a setting, so a "normal" click on the link will forever just open your browser, unless you go through the above procedure with Safari at least once.

Related