Jeff Johnson (My apps, PayPal.Me)

Universal Links Revisited

January 16 2023

A couple years ago I wrote about the monstrous Open in the Twitter app banner in Safari, which is caused by the Twitter app's adoption of Apple's Universal Links. My very clever (IMO) solution to this problem was to create a Mac app, very cleverly (IMO) named StopTheTwitter, that technically impersonated the official Twitter app by copying its bundle identifier. StopTheTwitter has a higher version number than the Twitter app, which makes Launch Services prefer it over the Twitter app. This seemed like a great solution (IMO)!

Unfortunately, my solution had one major downside I never noticed. The reason I never noticed is that I don't use the official Twitter app. When I was still using Twitter (I quit at the end of October), I used a combination of Tweetbot for Mac and my own Safari extension Tweaks for Twitter. After I wrote StopTheTwitter, I deleted the Twitter app from my Mac. In other words, I never updated it in the App Store. If I had kept the Twitter app, I might have noticed that I couldn't update it in the App Store!

Unable to Download App

Above is the kind of failure you might see if you tried to update Twitter in the App Store. I demonstrate here with my own app Link Unshortener (which is also on sale, by the way).

Consequently, StopTheTwitter was a clever idea a bit too clever for its own good, or for your good. I apologize for any inconvenience!

Fortunately, as always, I have another solution to the problem. The solution is another Mac app, but this time it's not one that I created. It's one of my favorite third-party Mac apps, Little Snitch!

Universal Links on the Mac operate via the swcd (Shared Web Credentials Daemon, /usr/libexec/swcd) process. According to its man page, dated 11/20/2016, swcd is a "Daemon providing support for technologies based on Associated Domains such as Shared Web Credentials and Universal Links." The man page doesn't say anything else.

As shown by Little Snitch, swcd attempts to phone home to Cupertino after you install the Twitter app.

swcd wants to connect to

For the sake of science, I'll allow the connection, which then establishes the Universal Link. Now let's see what happens when I open a tweet in Safari from another app, such as Terminal.

open -a Safari ""

Do you want to allow this page to open Twitter?

Cancel or Allow, where have I heard that before?

If I cancel, I still see the "Open in the Twitter app" banner in Safari.

Open in the Twitter app

The solution to the problem is to deny swcd with Little Snitch.

swcd Deny outgoing TCP connections

However, I've already allowed the Universal Link, which is still in effect. I also need to undo the damage of allowing it.

/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -f -R /Applications/

The above Terminal command uses the lsregister tool to force the Twitter app to re-register with Launch Services. Afterward, "Open in the Twitter app" is gone.

Safari with no banner

By the way, thanks for the tweet, Miguel!

Jeff Johnson (My apps, PayPal.Me)