How to find out if an application has access to the camera or not programmatically in iOS8

My application uses a camera. In iOS8, they include a new privacy setting, Camera , where the user can control the use of camera rights for each application.

Problem:
If a user does not allow my application to use the camera, then how can I find out that my application does not have access for the camera.
how can I use ALAssetsLibrary authorizationStatus to find out the status of the photo library or ABAddressBookGetAuthorizationStatus to find out the status of access to the phone book.

Question:
How can I find out if my application has camera access or not in iOS8, so that I can offer the user to allow camera access for my application?




I have below print screen photo paper that have the same problem as my application.

enter image description here

enter image description here

enter image description here




If there is no access to the camera, only a black screen will be displayed. No messages.
+14
ios8 xcode6 camera
Jul 09 '14 at 10:59
source share
1 answer

Check AVAuthorizationStatus for camera availability, and then handle cases accordingly

 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){ NSLog(@"Granted access"); } else { NSLog(@"Not granted access"); } }]; } 
+24
Jul 10 '14 at 18:43
source share
— -



All Articles