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],
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]; //This leaks
In both didFinishPickingMediaWithInfo
and imagePickerControllerDidCancel
I put this line:
[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.