开发者

How do i terminate an iPhone application gracefully in code

开发者 https://www.devze.com 2023-01-08 06:31 出处:网络
What i开发者_C百科s the proper way of ending an application on the iPhone when you are finished with it?

What i开发者_C百科s the proper way of ending an application on the iPhone when you are finished with it?

thanks,

anton


Jaanus is referring to this paragraph in the Apple iPhone Human Interface Guidelines

Stopping

People quit an iPhone application by opening a different application. In particular, note that people don’t tap an application close button or choose Quit from a menu. In iOS 4.0 and later, and on certain devices, the quitting application moves to a suspended state in the background. All iPhone applications should:

Be prepared to quit at any time. Therefore, save user data as soon as possible and as often as reasonable. Save the current state when stopping, at the finest level of detail possible. For example, if your application displays scrolling data, save the current scroll position. 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 If certain circumstances prevent only some of your application's features from working, you can display either a screen or an alert when users activate the feature. Although an alert doesn't allow much flexibility in design, it can be a good choice if you can:

Describe the situation very succinctly Supply a button that performs a corrective action Display the alert only when users try to access the feature that isn’t functioning As with all alerts, the less users see them, the more effective they are. For more information about creating alerts, see “Using Alerts.”


There is no way for an iPhone application to quit/terminate itself. Apple actively advises against it in their Human Interface and/or programming guides (can't remember which exactly) because it would look like a crash to the user.


An app should not terminate by itself.

Also, avoid showing an "exit screen" that prompts the user to quit the app manually as in iOS4, the app might stay open in the background and your user would be stuck in that exit state.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号