1

I want the user to start the app and leave it running. At one point, the app will finish what it is doing and will shut itself down.
How can I do that in Objective-C?

Cœur
  • 37,241
  • 25
  • 195
  • 267
user315067
  • 755
  • 4
  • 9
  • 13
  • possible duplicate of http://stackoverflow.com/questions/355168/proper-way-to-exit-iphone-application – Brad Larson May 06 '10 at 15:00
  • @ChiragKothiya, thank you for your edit: I've approved it. Just note that instead of using `
    `, you can use the markup syntax of two spaces and a new line. See my subsequent edit.
    – Cœur Jun 27 '18 at 07:59

2 Answers2

2

This is possible by using method:

exit(0);

However, be warned that Human Interface Guideliness discourage the use of this function, as it looks as if the application had crashed. The good solution for such a usecase is to prompt user that the application has finished working, and that he may close it now.

Hope this helps, Paul

Pawel
  • 4,699
  • 1
  • 26
  • 26
  • 1
    Apple does not like apps committing suicide: http://stackoverflow.com/questions/355168/proper-way-to-exit-iphone-application/356342#356342 – progrmr May 06 '10 at 12:37
0

Thanks Paul. I found another thread at Proper way to exit iPhone application? Perhaps Apple doesnt like applications committing suicide ;)

Community
  • 1
  • 1
user315067
  • 755
  • 4
  • 9
  • 13