NSString * mediaType = AVMediaTypeVideo;
AVAuthorizationStatus authorizationStatus = [AVCaptureDevice authorizationStatusForMediaType:mediaType];
if (authorizationStatus == AVAuthorizationStatusRestricted||
authorizationStatus == AVAuthorizationStatusDenied) {
UIAlertController *
alertC = [UIAlertControlleralertControllerWithTitle:@"摄像头访问受限" message:nilpreferredStyle:UIAlertControllerStyleAlert];
[self presentViewController:alertC animated:YEScompletion:nil];
UIAlertAction *
action = [UIAlertActionactionWithTitle:@"取消" style:UIAlertActionStyleCancelhandler:^(UIAlertAction *action)
{
[self dismissViewControllerAnimated:YEScompletion:nil];
}];
[alertC addAction:action];
}else{
}
时间: 2024-11-11 03:51:35