NSTask

The NSTask object is used to create and control new processes. When the process ends, the object will post an NSTaskDidTerminateNotification notification. Before creating (or launching) the new process, you will set the attributes of the new process with these methods:

-​ ​(​v​o​i​d​)​s​e​t​L​a​u​n​c​h​P​a​t​h​:​ ​(​N​S​S​t​r​i​n​g​ ​*​)​p​a​t​h​

Sets the path to the code that will be executed when the process is created.

-​ ​(​v​o​i​d​)​s​e​t​A​r​g​u​m​e​n​t​s​:​ ​(​N​S​A​r​r​a​y​ ​*​)​a​r​g​u​m​e​n​t​s​

Takes an array of strings that will be the arguments to the program.

-​ ​(​v​o​i​d​)​s​e​t​E​n​v​i​r​o​n​m​e​n​t​:​ ​(​N​S​D​i​c​t​i​o​n​a​r​y​ ​*​)​d​i​c​t​

You can use this to set the environment variables. If unset, the environment ...

Get Advanced Mac OS X Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.