Here is a good place to learn NSApplicationMain, following the reimplementation of the function. NSApplicationMain needs to be called from the main thread primarily because
- It processes the main interface
- User interface elements (on multiple systems, not just OS X) must be called on a single thread for proper operation.
- The graphical elements provided by Cocoa suggest that they will work in the main thread.
So much, since Cocoa calls things in the main thread, and the user interface needs to be run on the same thread, you need to work in the main thread for anything related to the user interface, including NSApplicationMain.
matthias
source share