I create a settings/editing type view controller like so:
EditViewController *editController = [storyboard instantiateViewControllerWithIdentifier:@"parent"];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:editController];
editController.delegate = self;
navController.modalPresentationStyle = UIModalPresentationPopover;
[self presentViewController:navController animated:YES completion:nil];
NOTE: EditViewController is a subclass of UITableViewController and 'self' is just the main navigation view controller.
Now from this presented navigation controller/view controller there is a UIImageView the user has an option to fill in by taking a photo from the camera, which they do from a button action:
- (IBAction)takePhotoForImageView:(UIButton *)sender {
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = YES;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.cameraDevice = UIImagePickerControllerCameraDeviceRear;
picker.modalPresentationStyle = UIModalPresentationFullScreen;
[self showViewController:picker sender:self];
// [self presentViewController:picker animated:YES completion:nil];
}
The code runs without crashing but I am getting the following in the debugger:
[Camera] Failed to read exposureBiasesByMode dictionary: Error Domain=NSCocoaErrorDomain
Code=4864 "*** -[NSKeyedUnarchiver _initForReadingFromData:error:throwLegacyExceptions:]: data
is NULL" UserInfo={NSDebugDescription=*** -[NSKeyedUnarchiver
_initForReadingFromData:error:throwLegacyExceptions:]: data is NULL}
[Presentation] Attempt to present <UIImagePickerController: 0x11d00fe00> on
<UINavigationController: 0x11e009c00> (from <EditViewController: 0x11d010c00>)
while a presentation is in progress.
I have no idea about the first error but assuming it's related to the second.
As for the second error/warning(?), dismissing the first presented controller before presenting the UIImagePickerController is not an option.
So the question is: What is the proper way to launch a UIImagePickerController (with a source type of UIImagePickerControllerSourceTypeCamera) from within another view controller which is also presented?