Rechecking camera access in iOS 8 after initial request is denied

If a user has denied camera access when they are first prompted afterwards pressing the button to take a snap shot results in a black screen in the camera mode. Therefore, we must first detect if the user has declined access and prompt them it must be turned on to function. The following code solves that problem in iOS

#import <AVFoundation/AVFoundation.h>

AVAuthorizationStatus status = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
    if(status == AVAuthorizationStatusAuthorized) { // authorized
    }
    else if(status == AVAuthorizationStatusDenied){ // denied
    }
    else if(status == AVAuthorizationStatusRestricted){ // restricted
    }
    else if(status == AVAuthorizationStatusNotDetermined){ // not determined

        [AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) {
            if(granted){ // Access has been granted ..do something
            } else { // Access denied ..do something}
        }];
    }