Program Termination Command

What is the programming statement that will stop a program from running?

I am looking for a programming statement that has the same effect as pressing

the "stop button" when running a program on an actual device from Xcode.

Accepted Reply

Apple says "don't" - see here.

Replies

Apple says "don't" - see here.

When not executing code inside one of the app's event driven callbacks, the app is not running. So simply return from whatever method(s) that is(are) running.


If you don't want you app to be active (frontmost) your app can send a URL that can start up another app (a URL to Safari, for instance).


The legal method to quit an app is to set the documented "exits on suspend" app plist key, and send a valid URL to Safari (et.al.)

That guideline is for app submissions to the App store. When running a test app from Xcode (not to be submitted as is), use an assert(false), exit(), or an outright illegal reference to kill an app.