在 iOS 4.0 中退出应用程序

Exit application in iOS 4.0(在 iOS 4.0 中退出应用程序)

本文介绍了在 iOS 4.0 中退出应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 iOS4.0 之前,单击 iPhone 上的主页按钮会退出应用程序,Apple 在其指南中规定不接受以编程方式退出应用程序.

Before iOS4.0 clicking the home button on iPhone exits the application, and Apple had in their guide that programmatically exiting the application was not accepted.

现在 iOS4.0 中的一切都发生了变化,单击主页按钮会使您的应用程序处于暂停模式(多任务处理).我认为应该有一个明确的方式让用户退出应用程序,例如退出按钮.

now everything changed in iOS4.0, clicking the home button puts your app in a suspended mode (multitasking).. and I think there should be a clear way for the user to exit the app, like an exit button.

现在可以用苹果了吗?怎么做?

is it now OK with apple? and how can it be done?

推荐答案

不还是不应该这样做.

您有不同阶段的处理程序,因此您应该这样做.手动退出没有意义.如果您重新启动应用程序,理想情况下它会从您停止的地方开始,因此可以通过恢复或启动并加载旧状态.

You have handlers for the different stages, so this is how you should do it. There's no point in exiting manually. If you restart the app, ideally it would start where you left off, so this is either by resuming or by starting and loading the old state.

没有理由退出.

编辑

因为这再次弹出:iOS 人机界面指南 说不要以编程方式退出".我们已经看到许多关于过去调用 exit() 的应用程序的报告.

As this keeps popping up again: iOS Human Interface Guidelines says "Don't Quit Programmatically". And we have seen many reports of apps that had calls to exit() in them in the past.

当然,通过在 Info.plist 文件中设置适当的键来退出而不是挂起完全没问题 - 但这不是专用的 UI 按钮,只是通过主页按钮执行程序退出的特定于应用程序的实现.

Exiting instead of suspending by setting the appropriate key in the Info.plist file is perfectly fine, of course - but that's not a dedicated UI Button, just application-specific implementation of program exit by the home button.

这篇关于在 iOS 4.0 中退出应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:在 iOS 4.0 中退出应用程序

基础教程推荐