【发布时间】:2018-07-06 22:13:27
【问题描述】:
我需要从应用程序启动“TextMate”,我使用了以下代码。
[NSTask launchedTaskWithLaunchPath:@"/Applications/TextMate.app" arguments:[NSArray arrayWithObjects:@"hello.txt", nil]];
但是,我得到了以下错误返回。
*** NSTask: Task create for path '/Applications/TextMate.app' failed: 22, "Invalid argument". Terminating temporary process.
- 我的代码有什么问题?我只是尝试运行“TextMate hello.txt”。
添加
我可以让它运行如下。
[NSTask launchedTaskWithLaunchPath:@"/Applications/TextMate.app/Contents/MacOS/TextMate" arguments:[NSArray arrayWithObjects:@"hello.txt", nil]];
我问another question 看看还有多少其他方法可用。
【问题讨论】:
标签: objective-c cocoa