收到内存警告和应用程序崩溃 [英] Received memory warning and app crashes

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

问题描述

由于收到内存警告,我的应用程序崩溃了.

my app is crashing due to Received memory warning.

如果我在运行该应用程序几分钟后执行任何操作,该应用程序将立即崩溃.

If i run the app for few minutes then on doing anything, the app crashes straightaway.

我什至检查了内存泄漏,但是没有内存泄漏.此外,该应用程序在模拟器中也能正常工作.

I have even checked for memory leaks but there are no memory leaks. Also the app is working fine in simulator.

我注意到的是,每当我收到接收到的内存警告",然后调用项目中每个文件的"didReceiveMemoryWarning"方法,然后应用崩溃.

What i have noticed is whenever i get a "Received memory warning", then "didReceiveMemoryWarning" method of every file in the project is called and then app crashes.

有什么解决办法吗?

推荐答案

好吧,坦率地说,您使用的内存过多.会调用 didReceiveMemoryWarning ,以便您可以尝试释放一些内存,以免使应用程序崩溃(释放未使用的东西,以后可以重新加载).

Well, to put it bluntly, you are just using too much memory. didReceiveMemoryWarning gets called so that you can try free up some memory yourself so you dont crash the app (free up things that aren't in use that can be reloaded later).

在运行应用程序时,模拟器并不是精确的硬件,所以我不会一直依赖它,这也许就是为什么您没有在模拟器上收到警告的原因.

The simulator isn't accurate hardware wise when it comes to running apps, so i wouldnt always rely on it, and thats probably why you dont get the warning on the simulator.

我真的不能说是什么原因导致您的应用程序根据您提供的信息使用了如此多的内存

I cant really say what is causing your app to use so much memory from the information you have given

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

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