Type Method

runWorkflowAtURL:withInput:error:

Loads and runs the specified workflow file.

Declaration

+ (id)runWorkflowAtURL:(NSURL *)fileURL withInput:(id)input error:(NSError * _Nullable *)error;

Parameters

fileURL

URL that specifies the location of a workflow file.

input

Specifies the input for the first action in the workflow. Pass nil if the first action doesn’t need input.

error

If no workflow is found or if an error occurs in initializing or running it, upon return contains an instance of NSError that describes the problem.

Return Value

This method returns nil on error, or if the action completes successfully without producing output. The error argument must be examined to determine which scenario occurred. Otherwise, this method returns the output of the last action in the workflow. Your application may need to convert the data to a desired type.

Discussion

Use this method to run a workflow without the overhead of performing a separate allocation, setting up a workflow controller, and so on. In situations where you need greater control, such as the ability to start and stop the workflow, use an instance of the AMWorkflowController class instead.

The workflow is run in a separate process so that any actions it contains are executed in a separate memory space. This helps to insulate the application from crashes, memory leaks, or exceptions that might occur from running the actions in the workflow.

See Also