我有一個URLHandler啓動一些應用程序,主要代碼如下。如何在Objective-C應用程序中退出?
@implementation URLHandlerCommand
- (id)performDefaultImplementation {
NSString *urlString = [self directParameter];
NSLog(@"url :=: %@", urlString);
NSTask *task;
task = [[NSTask alloc] init];
[task setLaunchPath: @"/usr/bin/open"];
NSArray *arguments;
arguments = [NSArray arrayWithObjects: @"-a", @"Path Finder.app", urlString, nil];
[task setArguments: arguments];
NSPipe *pipe;
pipe = [NSPipe pipe];
[task setStandardOutput: pipe];
NSFileHandle *file;
file = [pipe fileHandleForReading];
[task launch];
return nil;
}
把此程序的目標是啓動其他應用程序,我想使這個URLHandler啓動應用程序後退出。我怎樣才能做到這一點?
實際上,這是一個Mac應用程序,而不是iPhone應用程序。 – prosseek 2011-02-19 04:22:23
啊我明白了。對不起假設。 – aiham 2011-02-19 04:24:49