- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to exit iPhone application gracefully?
There are times we would like to close our application due to some reason, for example if there is no internet connection and you’d like to kill the app, or any other reason according to the application. Though apple prefers not quitting the application, hence it is not supported in any of the applications.
The only way to logically kill an iOS application is by pressing the home button. As soon as the home button is pressed, and the application exits the memory is freed up and cleaned.
Still there are other ways to quit an application.
exit − this command may be used to exit the application on required events, it can be used like exit(0)
Apart from exit, we may also use, [[NSThread mainThread] exit];
Or we can manually call the delegate method, - (void)applicationWillTerminate:(UIApplication *)application
But, as we saw earlier apple does not provide any perfect way of quitting applications using above methods, it’s best to show user an alert and ask them to press the home button to quit the application.
- Exit Methods in C# Application
- How can I send mail from an iPhone application?
- How to launch any arbitrary iPhone application from within another app?
- How to finish a Python CGI script gracefully?
- Difference Between exit(0) and exit(1)
- How to determine device type (iPhone, iPod Touch) with iPhone SDK?
- How to exit a process in Node.js?
- How to exit from a Python if clause?
- How to quit/ exit from MySQL stored procedure?
- How to make iPhone vibrate using Swift?
- exit() function in PHP
- How to exit from Python using a Tkinter Button?
- How to determine the current iPhone model information?
- How to access RESTFul services from iOS/iPhone?
- How to compare two NSDates in iPhone/iOS?