iOS 应用程序因内存压力而终止 [英] iOS app terminated due to memory pressure

查看:30
本文介绍了iOS 应用程序因内存压力而终止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的应用中使用图像文件.这些图像文件被压缩为 .zip 文件,用户可以通过 Mail App 或 Safari 打开该文件..zip 文件(包含图像文件)然后由SSZipArchive"解压缩.这对于较小的文件(例如 5 个图像,10KB)没有任何问题.但是对于更大的文件(1900 张图片,20MB),应用程序崩溃并且很难找出原因,因为它只会在应用程序未调试且未被 Instruments 监视时崩溃.有几次我在使用调试器时崩溃,但只有当我从邮件应用程序打开 .zip-Archive 时.然后我收到消息应用程序因内存压力而终止".

I am trying to use image files with my app. These image files are compressed in a .zip-file which is opened from the user from the Mail App or Safari. The .zip-file (which contains the image files) is then unzipped by "SSZipArchive". This works without any problem for smaller files (e.g. 5 images, 10KB). But for bigger files (1900 images, 20MB) the app crashes and it is hard to figure out why because it only crashes when the app is not debugging and not watched by Instruments. A few times I got a crash while using the debugger but only when I opened the .zip-Archive from the Mail App. I then got the message "App terminated due to memory pressure".

请帮忙!

推荐答案

您可能正在模拟器上进行测试.那是不可靠的,因为您的计算机有很多内存!在设备上进行测试,以了解在实际条件下您的应用程序是否使用了过多内存.如果是这样,您会收到警告,然后(如果您不采取措施解决问题)会被故意终止.

You're probably testing on the Simulator. That's never reliable, because your computer has lots of memory! Test on the device to find out under real-life conditions whether your app uses too much memory. If it does, you'll get a warning and then (if you don't do something about the problem) a deliberate termination.

这篇关于iOS 应用程序因内存压力而终止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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