使用Camera的UIImagePickerController的严重内存问题 [英] Severe memory problems with UIImagePickerController using Camera

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

问题描述

我注意到,当我加载UIImagePickerController并为其拍照时,会调用didReceiveMemoryWarning.另外,在Instruments中,存在大量内存泄漏(我发誓,不是我本人!).我听说这是UIImagePickerController的问题,但是我不确定如何解决它.这是我对UIImagePickerController的实现.

I've noticed that when I load a UIImagePickerController and I take a picture with it, didReceiveMemoryWarning is called. Also, in Instruments, there is a significant memory leak (not by me, I swear!). I've heard that this is a problem with UIImagePickerController but, I'm not sure how to fix it. Here is my implementation of UIImagePickerController.

    UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init]; // Create the imagePicker
    imagePicker.delegate = self; 
    imagePicker.allowsEditing = YES; // Allow editing of the images
    imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
    [self presentModalViewController:imagePicker animated:YES];
    [imagePicker release];

有什么想法吗?我真的不想牺牲这种有用的功能.

Any ideas? I really don't want to sacrifice such a useful feature.

推荐答案

您需要将图像重新缩放为较小的尺寸,例如320x460.然后它将成功运行.

You need to rescale the image to a smaller size, say 320x460. Then it will run successfully.

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

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