iPhone 在后台关闭应用程序:exit(0) 可以接受还是存在其他问题?

发布于 2024-11-08 14:37:34 字数 388 浏览 0 评论 0原文

在某些情况下,我需要阻止应用程序留在后台: 如何阻止 MPMoviePlayerViewController 下载如果应用程序在后台,则视频

我不想禁用多任务处理,但在某些情况下我需要关闭应用程序

exit(0) 效果很好,但是这是吗苹果认可吗? exit(0) 不会造成任何用户体验问题,因为它发生在后台,用户看不到任何内容。

有谁知道还有其他选择吗?

提前致谢!

I need to stop in some situation an application from remaining in background:
how to stop MPMoviePlayerViewController from downloading video if the app is in background

I don't want to disable the multitasking, but in some situation I need to close the app

exit(0) works perfectly, but is this approvable by Apple?
exit(0) doesn't create any user-experience problems, because it happens in background and the user doesn't see anything.

Does anyone know any other alternatives?

Thanks in Advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

策马西风 2024-11-15 14:37:34

不,这是不允许的,您应该让用户完全控制何时退出您的应用程序。

不要以编程方式退出

永远不要退出 iOS 应用程序
以编程方式因为人们倾向于
将其解释为崩溃。然而,
如果外部环境阻碍你
应用程序作为
有意的,你需要告诉你的用户
描述情况并解释原因
他们可以做些什么。取决于如何
应用程序故障严重,
你有两个选择。

显示一个有吸引力的屏幕
描述问题并提出建议
更正。屏幕提供反馈
让用户放心
你的申请没有任何问题。
它让用户掌控一切,让他们
决定他们是否想要采取
纠正措施并继续使用
您的应用程序或按主页
按钮并打开另一个
应用

如果只有您的应用程序的某些
功能不工作,显示
屏幕或警报时
人们激活该功能。展示
仅当人们尝试时才会发出警报
访问不存在的功能
功能正常。

http://developer.apple.com/库/ios/#DOCUMENTATION/UserExperience/Conceptual/MobileHIG/UEBestPractices/UEBestPractices.html

No, that's not allowed and you should give the user full control when to exit your app.

Don’t Quit Programmatically

Never quit an iOS application
programmatically because people tend
to interpret this as a crash. However,
if external circumstances prevent your
application from functioning as
intended, you need to tell your users
about the situation and explain what
they can do about it. Depending on how
severe the application malfunction is,
you have two choices.

Display an attractive screen that
describes the problem and suggests a
correction. A screen 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 only some of your application's
features are not working, display
either a screen or an alert when
people activate the feature. Display
the alert only when people try to
access the feature that isn’t
functioning.

http://developer.apple.com/library/ios/#DOCUMENTATION/UserExperience/Conceptual/MobileHIG/UEBestPractices/UEBestPractices.html

贩梦商人 2024-11-15 14:37:34

看起来我完全可以接受。 exit(0) 和内存警告的kill -KILL 之间没有太大区别。前提是您在启动后将 UI 恢复到相当一致的状态。

当然,AppStore警察可能有不同的意见......

Looks perfectly acceptable to me. Not much difference between exit (0) and the kill -KILL of a memory warning. Provided you restore the UI to a reasonably consistent state after startup.

Of course, AppStore police might have different opinions...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文