I have found many apps where you can press a button or something similar and the application will terminate and bring you back to the home screen. How would I do this?
A:
from http://www.iphonedevsdk.com/forum/iphone-sdk-development/6928-exit-application.html
[[UIApplication sharedApplication] terminateWithSuccess];
John Boker
2010-01-29 03:30:16
That is not a public API method.
St3fan
2010-01-29 03:37:16
the question didnt ask for a public api method.
John Boker
2010-01-29 04:10:58
Did so ask for public - what is iPhone sdk 3.0? if not public.
Aran Mulholland
2010-02-01 02:51:23
+1
A:
exit(0);
this can exit the app .
again, the best way I think will be like as follows:
//@step invoke the normal routine applicationWillTerminate
if ([[UIApplication sharedApplication].delegate respondsToSelector:@selector(applicationWillTerminate:)])
{
[[UIApplication sharedApplication].delegate performSelector:@selector(applicationWillTerminate:) withObject:[UIApplication sharedApplication]];
}
//@step force quite app
kill(getpid(), SIGINT);
I got it from other post on the overflow :D
Robin
2010-01-29 06:44:01