Terminates the receiver.
- macOS 10.0+
Typically, this parameter contains the object that initiated the termination request.
This method is typically invoked when the user chooses Quit or Exit from the app’s menu.
When invoked, this method performs several steps to process the termination request. First, it asks the app’s document controller (if one exists) to save any unsaved changes in its documents. During this process, the document controller can cancel termination in response to input from the user. If the document controller does not cancel the operation, this method then calls the delegate’s
application method. If
NSTerminate, the termination process is aborted and control is handed back to the main event loop. If the method returns
NSTerminate, the app runs its run loop in the
NSModal mode until the
reply method is called with the value
NO. If the
application method returns
NSTerminate, this method posts a
NSApplication notification to the default notification center.
Do not bother to put final cleanup code in your app’s
main() function—it will never be executed. If cleanup is necessary, perform that cleanup in the delegate’s