Hi everyone,
I have a Workflow file that I'd like to run from a Swift Mac app. This is my current code:
@IBAction func onChangeMode(_ sender: Any) {
guard let workflowPath = Bundle.main.path(forResource: "wf", ofType: "workflow") else {
print("resource not found")
return
}
let workflowURL = URL(fileURLWithPath: workflowPath)
do {
try AMWorkflow.run(at:workflowURL, withInput: nil)
} catch {
print("Error: \(error)")
}
}
However, I keep getting this error:
Error: Error Domain=com.apple.Automator Code=0 "Automator encountered an error running this workflow: “Sandboxed applications can not use Automator.framework to run workflows.”" UserInfo={NSUnderlyingError=0x600000cad8c0 {Error Domain=com.apple.Automator Code=0 "Sandboxed applications can not use Automator.framework to run workflows." UserInfo={NSLocalizedDescription=Sandboxed applications can not use Automator.framework to run workflows.}}, NSLocalizedDescription=Automator encountered an error running this workflow: “Sandboxed applications can not use Automator.framework to run workflows.”, NSLocalizedFailureReason=Sandboxed applications can not use Automator.framework to run workflows.}
How can I fix this? If anyone has a solution I'd be greatful - I'm new to Mac development.
Thank you all so much, and I hope you're all doing well during this time.
You must not use a sandbox for your app if you want to run workflows (that's what the error says!), so go to here:
And press on the circled "x" button. Note that apps without a sandbox can't be uploaded to the Mac App Store.