I used this code in my app:
//create task
NSTask * task=[[NSTask alloc] init];
[task setLaunchPath:@"/bin/ps"];
NSArray * arguments = [NSArray arrayWithObjects: @"axco command,pcpu",nil];
[task setArguments:arguments];
NSPipe *pipe = [NSPipe pipe];
[task setStandardOutput:pipe];
NSFileHandle *file = [pipe fileHandleForReading];
[task launch];
When I disable the sandbox, it works. But if I enable the sandbox, it crashes with this exception:
NSTask: Task create for path '/bin/ps' failed: 22, "Invalid argument". Terminating temporary process.
Can anyone help me resolve this issue?