I'm facing a strange problem....
On devices running iOS 10 camera preview shows black screen.
But in older version it works fine.
I'm using UIImagePickerController with
self.sourceType = UIImagePickerControllerSourceTypeCamera;
My info.plist file:


Example project: https://github.com/arturdev/cameraTest
I solved this with different approach.
Don't make subclass of UIImagePickerController because Apple does not support subclass of UIImagePickerController.
Important
The UIImagePickerController class supports portrait mode only. This class is intended to be used as-is and does not support subclassing. The view hierarchy for this class is private and must not be modified, with one exception. You can assign a custom view to the cameraOverlayView property and use that view to present additional information or manage the interactions between the camera interface and your code.
Here is alternate solution:
Add this code in UIViewController
self.imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera; self.imagePickerController.showsCameraControls = NO; self.imagePickerController.delegate = self; [self.view addSubview:self.imagePickerController.view]; [self addChildViewController:self.imagePickerController]; [self.imagePickerController didMoveToParentViewController:self];
Working Fine in all iOS version and devices. :):)
Use UIImagePickerController() instead of any other initializer.
I am facing the same problem, and it is caused by calling the wrong initializer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With