Reputation: 12808
I'm not sure which is the right way, right now I'm just calling exit(0)
when a user clicks on the exit button.
Upvotes: 5
Views: 6052
Reputation: 103
The previously given answer is deprecated since 10.10 and this question is the first thing that turns up for cocoa quit application, so use this instead (Swift):
NSApplication.sharedApplication().terminate(self)
Note: As of now it's the following:
NSApplication.shared().terminate(self)
Upvotes: 6
Reputation: 1316
I always terminate App the safe way.
[NSApp performSelector:@selector(terminate:) withObject:nil afterDelay:0.0];
This will put the event in the next loop.
Upvotes: 0