我正在为用户打开相机拍照。当我拍照并按下“使用”时,我不断出现内存泄漏:[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
在两者中didFinishPickingMediaWithInfo
,imagePickerControllerDidCancel
我都输入了这一行:
[imagePicker dismissModalViewControllerAnimated:YES];
我确实知道以前有人问过这个问题,但他们都没有看到对我的泄漏有任何帮助。