Siri Shortcuts and Workflow

Siri Shortcuts & Workflow

Apple’s Worldwide Developer Conference (WWDC) kicked off today and most of what was announced is interesting but nothing felt terribly revolutionary. Except for Siri Shortcuts. Siri Shortcuts is clearly what Apple has done with Workflow, which they purchased last year. I’ve used Workflow for iOS for some time now, but only recently have I started doing more and more with it. It has the ability to speak to various apps using URL schemes supported by the various apps (and using the x-callback scheme to get data back from them). It’s amazingly powerful and I have workflows that replicate an iTunes Playlist to my Spotify account or vice verse, alert my wife when I am on my way home complete with map and an ETA, to move items between Things, Trello, and Ulysses (it’s complicated), and so forth. (For the best collection of cool workflows and excellent descriptions of same, see the writings of Frederico Vittici at MacStories.net especially in their weekly newsletter, Club MacStories.

A workflow to set a slack reminder for myself
A workflow to set a slack reminder for myself

Sometime in the last while they also added the ability for Workflow to be able to talk to APIs using GET or POST. This is especially interesting to me as I work with a number of APIs in my day job, both external services we talk to and our own web applications. I use Paw on my Mac to test these APIs out but in my ever-ongoing quest to do more and more on my iPad Pro, having a tool that can do this there is gold to me. I haven’t started playing with it yet but I did push off the reminder in Slack all day today (hopefully I’ll get time to check it out tomorrow).

My great fear is that Apple’s reimagining of Workflow into Siri Suggestions, while adding all the power of Siri to control the shortcuts themselves, will also include a significant reduction in capabilities. Apple has had a track record of taking complex solutions and paring them down to, presumably, make them simpler, easier, and more elegant for their end users. But Workflow is a power tool and I would hate to lose any of the amazing functionality it currently offers.

Unfortunately, the new Siri Shortcuts app is not included in the initial beta 1 release of iOS 12 (and before my developer friends give me crap for installing it while not actually developing anything currently let me point out that I am using a work iPad Mini 4 that I have mostly stopped using in favor of my own personal iPad Pro. So it can be safely destroyed by a beta operating system and rebuilt from scratch with no ill effects to me or my current workflow). Since it is not included, I cannot test it out or see whether it is missing the features I consider essential.

That’s the only feature of iOS that jumped out at me as it is something that pertains to my own work. Most of the rest of the features look fun and I am looking forward to playing with them.

Update: Apple didn’t nerf it!

Fixing “Trust this computer” Problem

I had a strange problem crop up on my iMac running Yosemite and both of my iDevices (iPhone 6, iPad 4). When I plugged either in, I would get a dialog on the iMac saying photos could not be imported because the device was locked. On the devices themselves, I would be asked to Trust this computer. This happened every. single. time.

In the system.log, there were error messages to the tune of:

11/7/14 7:16:52.086 AM usbmuxd[57]: AMDeviceConnect (thread 0x1002fe000): Could not connect to lockdown port (62078) on device 1076 - [long ID number here]: 0xe8000084.

Digging further, I discovered that there is a directory, /var/db/lockdown, that contains a plist for each device connected to the Mac over the years (and since I have been leading an iOS Dev Team for Ozmott, I had a lot of devices listed in there!) and it seems that, for some reason, changes were no longer taking. I am not sure why. There were no errors related to permissions or otherwise.

On the advice of a thread I found online after some extensive Googling, I removed the lockdown directory. Theoretically, it would be recreated by the system. However, it wasn’t. Now when I connected my devices, I got the following errors:

11/7/14 7:22:44.510 AM com.apple.usbmuxd[57]: WriteDataToPath unable to create file /var/db/lockdown//SystemConfiguration.plist.tmp: No such file or directory.
11/7/14 7:22:44.510 AM com.apple.usbmuxd[57]: CreateAndStoreBUID WriteDataToPath failed: No such file or directory

So, I created a new lockdown directory using sudo mkdir lockdown. Then the errors changed to:

11/7/14 7:27:09.767 AM com.apple.usbmuxd[57]: WriteDataToPath unable to create file /var/db/lockdown//SystemConfiguration.plist.tmp: Permission denied.
11/7/14 7:27:09.767 AM com.apple.usbmuxd[57]: CreateAndStoreBUID WriteDataToPath failed: Permission denied

The directory was owned by root (because I created it using sudo) and clearly needed to belong to the usbmuxd process. Directories belonging to processes are named for the process preceded by an underscore. So I executed: sudo chown _usbmuxd lockdown.

That worked. Plugging in my devices resulted in the same dialogs as before but once I told the iDevices to trust the computer, new plist files were created for each and subsequent connects/disconnects have not had the errors recur. We’ll see if this sticks over time but at least I know how to fix it, even if temporarily.

Update 18 December 2014: The problem routinely returns. After I leave my computer running for a day or so, the problem comes back. I haven’t needed to resort to the fix above as simply rebooting my computer fixes it. It’s safe to say that something I am running on my machine is responsible. Now for the sleuthing…

Update 15 January 2015: Solved! Thanks to this thread on Stack Overflow, I have a solution that works! When this happens, open up a terminal and type

sudo launchctl stop com.apple.usbmuxd

And it restarts the broken usbmuxd process and things are happy again.