在引导访问模式下,应用程序不询问用户访问摄像机的权限吗?

时间:2018-06-29 11:42:49

标签: kiosk-mode guided-access

如果我未使用引导访问模式。我收到摄像机访问警报的请求,并且运行正常

我也在info.plis中添加了说明

- (IBAction)goToCamera
{
AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
if(authStatus == AVAuthorizationStatusAuthorized)
{
    [self popCamera];
}
else if(authStatus == AVAuthorizationStatusNotDetermined)
{
    NSLog(@"%@", @"Camera access not determined. Ask for permission.");

    [AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted)
    {
        if(granted)
        {
            NSLog(@"Granted access to %@", AVMediaTypeVideo);
            [self popCamera];
        }
        else
        {
            NSLog(@"Not granted access to %@", AVMediaTypeVideo);
            [self camDenied];
        }
    }];
}
else if (authStatus == AVAuthorizationStatusRestricted)
{
    // My own Helper class is used here to pop a dialog in one simple line.
    [Helper popAlertMessageWithTitle:@"Error" alertText:@"You've been restricted from using the camera on this device. Without camera access this feature won't work. Please contact the device owner so they can give you access."];
}
else
{
    [self camDenied];
}
}

0 个答案:

没有答案