2

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?

kanso
  • 750
  • 8
  • 17
  • The second warning is normal when you present a VC while one is already presented, `exposureBiasesByMode` seems to be an error related to the camera. Does this warning appear in all devices/simulator? – Itay Brenner Sep 25 '20 at 04:21
  • @ItayBrenner even i am facing same issue in only iOS14. And also some time picker is not compress video. – Ayaz Oct 11 '20 at 06:38

0 Answers0