我正在尝试运行一个必须执行 echo "Hello World"的简单任务
那么这是我的代码:
NSTask *task;
task = [[NSTask alloc] init];
[task setLaunchPath:@"/bin/bash"];
NSArray *arguments;
arguments = [NSArray arrayWithObjects:@"echo","hello world" nil];
[task setArguments: arguments];
NSPipe *pipe;
pipe = [NSPipe pipe];
[task setStandardOutput: pipe];
[task setStandardError: pipe];
NSFileHandle *file;
file = [pipe fileHandleForReading];
[task launch];
//...
//Code to get task response
继续给我没有这样的文件或目录错误..我做错了什么?