How to quit itself in Objective-C application?

前端 未结 2 1017
没有蜡笔的小新
没有蜡笔的小新 2021-01-17 19:10

I have a URLHandler that launches some application, the main code is as follows.

@implementation URLHandlerCommand

- (id)performDefaultImplementation {
             


        
相关标签:
2条回答
  • 2021-01-17 19:35
    1. You don't have to launch open using NSTask... open just calls into Launch Services, some of whose functionality is directly available from NSWorkspace.

    2. To quit, you just call [[NSApplication sharedApplication] terminate:nil]. See NSApplication documentation.

    0 讨论(0)
  • 2021-01-17 19:48

    This has been answered here: Proper way to exit iPhone application? however you should also take a look at August's answer. Although it's not the accepted answer, it has been voted higher and it also follows Apple's set standards since Apple advises against force quitting iPhone applications.

    0 讨论(0)
提交回复
热议问题