I need to launch 'TextMate' from an App, and I used the following code.
[NSTask launchedTaskWithLaunchPath:@"/Applications/TextMate.app" arguments:[NSArray arrayWithObjects:@"hello.txt", nil]];
But, I got the following error return.
*** NSTask: Task create for path '/Applications/TextMate.app' failed: 22, "Invalid argument". Terminating temporary process.
- What's wrong with my code? I just tried to run "TextMate hello.txt".
ADDED
I could make it run as follows.
[NSTask launchedTaskWithLaunchPath:@"/Applications/TextMate.app/Contents/MacOS/TextMate" arguments:[NSArray arrayWithObjects:@"hello.txt", nil]];
And I asked another question to see how many other ways available.