How to exit the Objective-C application?

I have a URLHandler that launches some kind of application, the main code is as 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; } 

Since the purpose of this procedure is to launch another application, I would like this URLHandler to exit after the application starts. How can i do this?

+8
objective-c protocol-handler
source share
2 answers
+18
source share

Here was the answer: The correct way to exit the iPhone application? However, you should also take a look at the August answer. Although this is not an accepted answer, it was acknowledged to be higher, and it also follows Apple standards, as Apple advises abandoning iPhone apps.

+1
source share

All Articles