In an app, I'm currently taking a picture only after camera permissions have been checked, as follows:
AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
if(authStatus == AVAuthorizationStatusAuthorized) {
// Take picture
}else{
// Prompt user to go into their settings and add permissions for app
}
However, on first use, a) the initial "Would you like to give this app camera permissions?" prompt does not appear, and b) the app doesn't appear in the iPad's settings under privacy -> camera. This leads to the unfortunate case of not being able to ever allow camera permissions in the app.
Any suggestions on how to avoid this would be much appreciated. Thanks for reading.
You need to request for permission using the following code:
AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
if(authStatus == AVAuthorizationStatusAuthorized)
{
// Take picture
}
else
{
[AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted)
{
if (granted)
{
NSLog(@"User Granted");
}
else
{
NSLog(@"User Denied");
}
}];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With