I\'m having some issues trying to use the camera. The problem is that some devices show me the Camera entry under settings, and some others don\'t. In those devices where the Ca
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
}
})