iOS Camera permissions doesn't appear under settings in some devices
You need to request permission before opening a session. Use
[AVCaptureDevice requestAccessForMediaType:completionHandler:]
Step 1: Give a proper camera message access message on your info.plist using the following key (without quotes)
"Privacy - Camera Usage Description"
Step 2 : For objective-C/SWIFT you need to request a camera access permission
OBJECTIVE-C
[AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted)
{
if (granted == true)
{
//[self presentViewController : picker animated:YES completion:NULL];
//Do your stuff
}
else
{
UIAlertView *cameraAlert = [[UIAlertView alloc]initWithTitle:STR_APPLICATION_TITLE
message:STR_ALERT_CAMERA_DENIED_MESSAGE
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil,nil];
[cameraAlert show];
NSLog(@"denied");
}
}];
SWIFT
AVCaptureDevice.requestAccessForMediaType(AVMediaTypeVideo, completionHandler: { (videoGranted: Bool) -> Void in
if (videoGranted) {
//Do Your stuff here
} else {
// Rejected Camera
}
})