将应用程序发送到后台并在下面的窗口中显示应用程序

发布于 12-06 19:38 字数 225 浏览 1 评论 0原文

我不希望我的应用程序在后台运行,我只想在我的应用程序收到内存警告时为用户提供关闭他/她的其他应用程序的选项。也就是说,我的应用程序显示带有“取消”和“确定”按钮的警报视图。如果他/她触摸“确定”,则会模拟按两次主页按钮。是否可以?

我在他们的设置中有这个选项,即他们是否想看到内存警告。我提到我不希望我的应用程序在后台运行,因为我看到这里提出了许多有关在后台运行自己的应用程序的问题。这与我的问题无关,我只是想澄清一下。

I dont want my app to run in background, I only want to give the user the option to close his/her other app(s) when my app gets a memory warning. That is, my app shows an alert view with Cancel and OK buttons. If s/he touches OK, then the twice push on the home button is simulated. Is it possible?

I have this as an option in their settings, i.e. if they want to see the memory warning or not. I mentioned that I don't want my app running in background, because I see many questions asked here about running their own app in background. It is not relevant to my question, I just wanted to make it clear.

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

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

发布评论

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

评论(2

红玫瑰2024-12-13 19:38:51

不适用于公共 API。
除此之外,当您收到内存警告时,您应该只关心您分配和使用的资源,而不是要求其他人代替您释放内存。

Not with public APIs.
Beside that, when you receive a memory warning you should only take care of the resources you allocate and use, and not ask someone else to free memory instead of you.

一身仙ぐ女味2024-12-13 19:38:51

这是不可能的。

当您的应用程序收到内存警告时,它应该采取负责任的行动并尽可能释放内存。来自 Apple 文档

当视图控制器收到内存警告时
(didReceiveMemoryWarning),它应该放弃资源的所有权
当前不需要并且可以在以后重新创建
必填。

我不太确定这与不在后台运行您的应用程序有什么关系。

This is not possible.

When your app receives a memory warning it should act responsibly and free memory where it can. From the Apple docs

When a view controller receives a memory warning
(didReceiveMemoryWarning), it should relinquish ownership of resources
that are currently not needed and that can be recreated later if
required.

I'm not quite sure what this has to do with not running your app in the background.

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