3

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?

doubleDown
  • 8,048
  • 1
  • 32
  • 48
  • Take a look in Console to view if there are some sandbox messages – usain Jul 22 '13 at 11:56
  • I don't see anything else sandbox messages. My app is crash and print only message in console: NSTask: Task create for path '/bin/ps' failed: 22, "Invalid argument". Terminating temporary process. Please give me details your solutions. Thanks very much – ThuanNguyen Jul 23 '13 at 06:39

0 Answers0