Sandboxed applications can not use Automator.framework to run workflows

Sandboxed my app containing actions and workflow management using AMWorkflowController.

Encountered error


Bundle: CFBundle 0x10130f910 </System/Library/Frameworks/Automator.framework> (not loaded), key: Sandboxed applications can not use Automator.framework to run workflows., value: , table: Localizable, localizationName: (null), result: Sandboxed applications can not use Automator.framework to run workflows.


Workflow actions are bundled together with app.

Does this mean i won't be able to run and submit app which runs workflow ?


Any workarounds ?

Replies

Did you tried go to System preferences > Security & Privacy > Automation > An add your app there?

AppleScript, upon which Automator is based, is generally not available to sandboxed apps. I have seen reports that sometimes AppleScript can be used for 3rd party apps, but I can't vouch for that and I'm sure most people are interested in scripting Apple apps, which is strictly forbidden.

There are standard view controller automator components for cocoa apps.

And I expect to them to work and also distribute app with them.

I am not surprised many people think of Automator as Apple script bridge.

But there are workflows, which uses zero apple script and allows users to automate their tasks with building blocks(no scripting required).

For executing user-supplied workflows, use NSUserAutomatorTask. For executing workflows that are part of your app, you may a problem. Might want to file a ticket on the AMWorkflow class documentation requesting clarification of sandbox limitations. Although with Siri Shortcuts liable to make the jump to macOS next year, the future of AMWorkflow is likely moot anyway.

The sandbox is different. Apple provides APIs for the platform, not for distribution methods. Official sandbox limitations are not documented, or even known, in any way. If there is some architecture that is heavily dependent on AppleScript, then there is a good chance it is not going to work.


More importantly, except in very unusual circumstances, virtually all a developer’s efforts to get around the sandbox are a wasted effort. You aren’t going to get any temporary exceptions. You aren’t going to find a magic cheat code. You aren’t even going to be able to definitively find out what should and what shouldn’t work. I have a sandboxed app where some things don’t work, but only when run from the command line.


Your best option is to removeall the Automator stuff. See if there is a way to provide some of this functionality without Automator.

Good find.

Sadly there's no add button even after unlocking preference.

I am wondering if there's a way to present user with consent dialog asking them to allow app to do automation tasks ?

(the same way it's done with location, contacts and other requests)

Right thinking. Totally agree on sandbox topic.

As for Automation Workflow, It's just hard to let it go as it serves the purpose so well.

I'll try saving workflow as a file and suspect it'll open with Automator and then it should work.

The other way is not to sandbox and distribute outside AppStore.

I'll keep this topic updated.