iPhone中的UIImagePicker中的内存泄漏 [英] Memory leak in UIImagePicker in iphone

查看:44
本文介绍了iPhone中的UIImagePicker中的内存泄漏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,用户可以从相机拍摄尽可能多的照片,因此在拍摄了三遍照片后,它崩溃了.我无法调整图像的大小(其要求).还有其他方法可以避免内存泄漏.

In my app user can take as may picture from camera, so after three time taking the picture it crashed. I can't resize the image (its requirement). So is there any other way to avoid memory leak.

谢谢

推荐答案

uiimagepickercontroller 存在内存泄漏的已知问题.

There is a know issue with the uiimagepickercontroller with memory leaks.

Apple建议您仅分配和实例化一个 实例,并将其存储在应用程序生命周期内的某个位置(即运行时).

Apple recommend that you only allocate and instantiate only one instance and store it somewhere for the life of the application (whilst running that is).

不要创建新的,每次使用时都要使用它并重新分配它使用控件.如果这样做,您的内存使用量将不断增加直到它使您的应用崩溃.

Don't create a new one, use it and deallocate it each time you want to use the control. If you do, your memory usage will keep increasing until it crashes your app.

我个人将其存储为appDelegate中的属性,但是可能有更好的方法.

Personally I store it as a property in the appDelegate, but there may be a better way of doing it.

这篇关于iPhone中的UIImagePicker中的内存泄漏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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