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?

  1. you don't have launch open using nstask... open calls launch services, of functionality directly available nsworkspace.

  2. to quit, call [[nsapplication sharedapplication] terminate:nil]. see nsapplication documentation.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -