ios - 在事件应用程序中未调用 didReceiveMemoryWarning

标签 ios ipad memory

我有一个使用大量数据的应用程序,当我观看控制台时,我看到以下几行,然后应用程序被杀死。

Sep  6 13:37:35 unknown SpringBoard[29] <Warning>: Received memory warning. Level=1
Sep  6 13:37:35 unknown configd[25] <Notice>: jetsam: kernel memory event (90), free: 556, active: 3993, inactive: 1967, purgeable: 0, wired: 15073
Sep  6 13:37:35 unknown SpringBoard[29] <Warning>: Received memory warning. Level=2
Sep  6 13:37:35 unknown configd[25] <Notice>: jetsam: kernel memory event (95), free: 556, active: 1889, inactive: 944, purgeable: 0, wired: 15088

这对我来说很有意义,没有意义的部分是我的应用程序委托(delegate)没有收到 applicationDidReceiveMemoryWarning 消息并且我的 View Controller 没有收到 didReceiveMemoryWarning。

有没有人见过这个或有任何建议来帮助我解决这个问题。当应用程序可见时会发生这种情况,因此它不在后台。如果这有什么不同,我正在使用 iPad 1

提前致谢!

最佳答案

我在 iPad 设备上运行时看到了这一点(尽管不是在 iPhone/iPod 上)。我仍在寻找替代方案,但我目前的解决方案是仅基于计时器(放置在我的应用程序委托(delegate)中,在“didFinishLaunchingWithOptions”中)方法在设备上强制发出低内存警告:

// iPad doesn't seem to get the low memory warnings correctly - it just eventually crashes.  We're going to force them here every 20 seconds.
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
    [NSTimer scheduledTimerWithTimeInterval:20.0 target:[UIApplication sharedApplication] selector:@selector(_performMemoryWarning) userInfo:nil repeats:YES];

这肯定有味道,我不确定苹果是否会接受它。但是,它似乎让我的 iPad 现在可以正常工作了。

关于ios - 在事件应用程序中未调用 didReceiveMemoryWarning,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7324041/

相关文章:

ios - vm_allocate之后释放内存

ios - 为什么 AVAssetWriter 会膨胀视频文件?

iphone - 从邮政编码获取 CLLocation 坐标?

css - 980 像素 wrapper 不以 Ipad 为中心

c - 无效写入——Valgrind

ios - iPad 横向显示纵向框架和边界

ios - 存储可解码到 Realm 但数组始终为空

ipad - 我如何为 iPad mini 开发应用程序

c++ - 避免由 new(new[]) 引起的内存泄漏

c - 通过内联汇编锁定内存操作