presentModalViewController上的内存泄漏 [英] Memory leak on presentModalViewController

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

问题描述

我正在打开相机供用户拍照. 拍照并按使用"键时,我不断出现内存泄漏: [自身presentModalViewController:imagePicker动画:是],

I'm opening a camera for the user to take a picture. I keep getting a memory leak when I took a picture and pressed "use" on: [self presentModalViewController:imagePicker animated:YES],

完整代码:

imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;      
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.mediaTypes = [NSArray arrayWithObjects:
                              (NSString *) kUTTypeImage,
                              (NSString *) kUTTypeMovie, nil];
imagePicker.allowsEditing = NO;

[self presentModalViewController:imagePicker animated:YES]; //This leaks

didFinishPickingMediaWithInfoimagePickerControllerDidCancel中,我都这样写:

[imagePicker dismissModalViewControllerAnimated:YES];

我确实知道之前曾问过这个问题,但是他们中没有一个人对我遇到的泄漏有进一步的帮助.

I do know this question has been asked before but none of them seen to help me any further with the leak I have got.

推荐答案

原来,这是iOS自身代码中的错误.

Turns out this is a bug in the code of iOS itself.

我下载了Apple Developer网站的示例代码,并且发现了同样的漏洞. 因此,这无济于事,我希望自己能尽快解决.

I downloaded the sample code of the Apple Developer Website and the same leak turned up. So this will be nothing I can fix myself and I hope this gets corrected soon.

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

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