iOS应用程序可以在后台收到内存警告吗? [英] Can an iOS application receive a memory warning in the background?

查看:94
本文介绍了iOS应用程序可以在后台收到内存警告吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当应用程序在后台并且另一个应用程序正在运行并且需要更多内存时,后台应用程序是否会收到内存警告?或者它只能在没有任何警告的情况下从内存中被杀死?

When an application is in the background and another application is running and is requiring more memory, can the app in the background receive a memory warning? Or can it only get killed from the memory without any warning?

如果是后者,我应该手动释放applicationDidEnterBackground方法中的内存(缓存),以便它被杀的可能性更小?

If it's the latter, should I manually free up memory (cache) in the "applicationDidEnterBackground" method so that there is less chance that it will get killed?

非常感谢!

推荐答案

是的,您的应用程序可以在后台收到内存警告。如果系统确实需要内存,你的应用程序只会被立即杀死,但它会很好用,并要求你的应用程序首先自行返回内存。如果系统满意,它将不会终止您的应用程序。

Yes, your application can receive a memory warning while in the background. Your application only gets killed immediately if the system really needs the memory, but it'll play nice and ask your application to return memory on its own first. If the system is satisfied it won't kill your application.

这篇关于iOS应用程序可以在后台收到内存警告吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆