iOS:didReceiveMemoryWarning 的帮助: [英] iOS: helpfulness of didReceiveMemoryWarning:

查看:33
本文介绍了iOS:didReceiveMemoryWarning 的帮助:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我参与了我的开发过程以追踪崩溃和内存泄漏.作为一种策略,您是否将任何 NSLog 消息或通知放入 didReceiveMemoryWarning: 中?这种方法的文档相当稀少.在崩溃发生之前,UIViewController 会触发该方法是否准确?这是在继续使用 Instruments 之前的起点吗?

I'm at the part of my development process for tracking down crashing and memory leaks. As a strategy, do you put any NSLog messages or notifications of some such into didReceiveMemoryWarning:? The documentation for this method is rather sparse. Is it accurate to say that before a crash will happen, the UIViewController will trigger that method? Is that a starting point before even going forward with Instruments?

推荐答案

好的,有几点需要注意:

OK, several things to note:

  • didReceiveMemoryWarning 将在内存不足崩溃之前被调用.不是其他崩溃.如果您正确处理警告并释放内存,那么您就可以避免内存不足的情况而不会崩溃.
  • 您可以在硬件菜单下的模拟器中手动触发内存警告.强烈建议您这样做以测试您对 didReceiveMemoryWarning 的处理.
  • 仪器可帮助您调试泄漏(尽管不是全部) - 它对于崩溃并不是很有用.
  • 不,我个人不使用 NSLog - 我只是在调试时断点内存警告.

这篇关于iOS:didReceiveMemoryWarning 的帮助:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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