Remotely Closing the App
I have a button in my UI and was wondering if you are able to close the app and exit to the homescreen if you press it. Thanks!
You can always call exit(0) but it is against Apple's design guidelines to close applications programatically. The recommended way is when the user press the home button.
I don't know your thoughts for doing this, but try explaining why or at least think it over again :)
A snippet from the HIG
iPhone applications should never quit programmatically because doing so looks like a crash to the user. There may be times, however, when external circumstances prevent your application from functioning as intended. The best way to handle this is to display an attractive screen that describes the problem and suggests how users can correct it. This helps users in two ways: ■ It provides feedback that reassures users that there’s nothing wrong with your application ■ It puts users in control, letting them decide whether they want to take corrective action and continue using your application or press the Home button and open a different application
This method works also [[UIApplication sharedApplication] terminateWithSuccess];
, but as mentioned shouldn't be used for distribution on the AppStore.
精彩评论