I open the camera so that the user can take a picture. I keep getting a memory leak when I took a snapshot and clicked “use”: [self presentModalViewController: imagePicker animated: YES],
Full code:
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];
In both didFinishPickingMediaWithInfoand imagePickerControllerDidCancelI put this line:
[imagePicker dismissModalViewControllerAnimated:YES]
I know this question was asked before, but none of them saw me help me with the leak that I received.
source
share