Shortcuts Issue

I’ve been working on a shortcut to clip a selection from a webpage rendered in Safari with a specific formatting to iA Writer. The shortcut worked, but only I managed to get the shortcut running once.

Every repeated execution would just not happen. The button in the share sheet will respond to a tap, but no activity is executed. Not only that, no other shortcut on the share menu will work after I ran my clip to iA Writer shortcut. The only way to get out of this is to force-restart the device1.

After the restart, the shortcut will (again) run successfully once, and then the mechanism for executing shortcuts seems to get locked up again.

For debugging, I split the shortcut in two parts. The first part will clip the text, apply the mentioned formatting to it, and copy the result into the clipboard:

Selection to Clipboard

This shortcut works just fine. And I can repeat this action as much as I want, no problem.

The second part takes the text from the clipboard, URL-encodes the text, and casts it into the URL scheme for getting the content into iA Writer:

Clipboard to iA Writer

Again, this part (for itself) works reliably, over multiple executions of the shortcut.

That’s right, the weird part about this is that I can run the two shortcuts independently from each other in succession without locking the shortcuts execution up as described above. Everything will work just fine and the text is reliably created in iA Writer just as it should be.

Having arrived at this point, I figured I might as well call the second shortcut from the first and let them (if this turns out to be the magic incantation) communicate via the clipboard. Maybe I could avoid the lock-up this way.

Nope, no such luck. The execution of shortcuts locks up again until I reboot my device.

As the next step in tracking this issue down, I have created a Python script in Pythonista that does exactly the same as the original undivided shortcut. The script runs just fine repeatedly, without locking up anything.

So, the takeaway from this experience seems to be that, unless I managed to create a bug in my own implementation, there might be some weird issue with shortcuts that execute URL schemes in general2 and are executed in the context of a text selection within a web page rendered in Safari.

This does not seem such an exotic combination that it never got properly tested. And yet, I have no other explanation for this phenomenon right now,


  1. I also tried closing Safari, the Shortcuts app, and iA Writer from the task manager, but this did not release the lock. 
  2. To let iA Writer off the hook, I tested the shortcut with a URL scheme for Bear. Same issue. 
Mastodon