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.

4

2 回答 2

3

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

于 2011-09-28T12:07:43.250 回答
1

这是不可能的。

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

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

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

于 2011-09-28T12:19:01.233 回答