iPhone中的UIImagePickerController的内存泄漏问题 [英] Memory Leak Problems with UIImagePickerController in iPhone

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

问题描述

我正在将以下代码用于UIImagePicker,

I am using the following code for UIImagePicker,

UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];  
imagePicker.delegate = self;

[self presentModalViewController:imagePicker animated:YES];
[imagePicker release];

运行仪器时,我在代码的第一行看到内存泄漏.尽管我正在发布它,但它仍然显示内存泄漏,是否有人知道我要去哪里错了.

When I run instrument, I see a memory leak on the first line of the code. Though I am releasing it, still its showing memory leak, does anyone have any idea where am I going wrong.

我从iPhone开发者示例代码帮助中安装了iPhoneCoreDataRecipes应用程序,它也有同样的问题.

I installed the iPhoneCoreDataRecipes Application from iPhone Developers Sample Code help and it is having the same problem.

推荐答案

我自己已经看到了.我认为这是Apple代码中的问题,我通过仅保留UIImagePickerController的单个实例,然后根据需要重新使用它来解决"它.否则,在对UIImagePickerController进行20次左右实例化后,我的应用程序将耗尽内存.

I have seen this myself. I think it's a problem in Apple's code, and I "solved" it by just keeping a single instance of the UIImagePickerController around, and re-using it as needed. Otherwise, my app would run out of memory after 20 or so instantiations of a UIImagePickerController.

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

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