使用UIImagePickerController出现内存泄漏的问题

今天公司的app一点开就闪退,于是就查了内存泄漏的问题,用Instruments 发现选择照片后没多久就出现UIStatusBarHideAnimationParameters这个问题,本来还以为是状态栏的事,后来网上查了点资料,说是UIImagePickerController的问题,想请问一下怎么解决?
试过了在didFinishPickingMediaWithInfo 方法里把imagepicker的代理设为nil,
但还是不行

代码:

-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{

if ([self.mutiImageSelector.imgArr count] < 3) {

UIImage *img = [info objectForKey:UIImagePickerControllerOriginalImage];

//生成缩略图

UIImage *thumbNail = [self createThumbnailWithSourceImge:img andNewSize:self.mutiImgSelectorImgViewSize];

[self.mutiImageSelector.thumbNailArr addObject:thumbNail];

[self.mutiImageSelector.imgArr addObject:img];

[self.mutiImageSelector.imgTabelView reloadData];

//保存拍照的照片到相册

if (self.takePicBtn.state == 1) {

UIImageWriteToSavedPhotosAlbum(img, self, nil, NULL);

}

picker.delegate = nil;

[self.myImgPickerController dismissViewControllerAnimated:YES completion:nil];

}else if ([self.mutiImageSelector.imgArr count] >= 3){

UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"error" message:@"最多只能上传3张图片" delegate:self cancelButtonTitle:@"ok" otherButtonTitles:nil, nil];

[alertView show];

}

}

图片描述

回答:

你能确认是UIImagePickerController的内存泄露,还是你用到的其他方法有内存泄露吗?

以上是 使用UIImagePickerController出现内存泄漏的问题 的全部内容, 来源链接: utcz.com/p/187715.html

回到顶部