protocol handler - How to quit itself in Objective-C application? -
i have urlhandler launches application, main code follows.
@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; }
as goal of routine launch application, i'd make urlhandler quit after launching app. how can that?
you don't have launch
open
usingnstask
...open
calls launch services, of functionality directly available nsworkspace.to quit, call
[[nsapplication sharedapplication] terminate:nil]
. seensapplication
documentation.
Comments
Post a Comment