seelts seelts - 1 year ago 86
iOS Question

Can't request camera access

I have an app with camera access.

It was working as needed until recent times.

May be it is related to iOS10...

So, here is how I ask user for camera access:

- (void)checkCameraAuthorization {
AVAuthorizationStatus status = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
switch (status) {
case AVAuthorizationStatusAuthorized: {
case AVAuthorizationStatusNotDetermined: {
[AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) {
// never gets here
default: {
// denied or restricted;
isAccessible = NO;
[self inaccessibleCameraExit];

As I've said this code worked some time ago.

Now, it throws an exception after
AVCaptureDevice requestAccessForMediaType:
being executed.

If I comment out the call to this method, everything works except camera certainly.

enter image description here

Exception is not pointing to my code and not in my thread.

So, can you please help me to return camera to working state.

Answer Source

You need to add NSCameraUsageDescription in your info.plist for iOS 10, this is the update from iOS 10.

For more information check this

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download