You can call exit (0) to shut down the application. But Apple does not like this, as it gives the user a sense of sudden failure. If you still want to have an exit function (with a potential risk of rejection), you should also send an applicationWillTerminate message (if you have something important there) to the application delegate before exiting.
source
share