Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Task create failed error for NSTask



Hello all,
I tried to launch a application named "abc.app" use NSTask, I write code
as follows:
NSArray * args = [[NSArray alloc] initWithObjects:@"2", nil];
[NSTask launchedTaskWithLaunchPath:@"/Users/feil/Desktop/abc.app"
arguments:args];

I always get error message:Task create for path abc.app failed.

I think maybe I should change current directory for the NSTask, so I
change my code to
NSArray * args = [[NSArray alloc] initWithObjects:@"2", nil];
NSTask * theTask = [[NSTask alloc] init];
[theTask setCurrentDirectoryPath:@"/Users/feil/Desktop/"];
[theTask setLaunchPath:@"abc.app"];
[theTask setArguments:args];
[theTask launch];
But I also get the same error.

Thanks for any help for helping me out!

Fei




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.