摄像头权限未开启时弹框跳转到设置页面
AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];//读取设备授权状态
if (authStatus == AVAuthorizationStatusRestricted || authStatus == AVAuthorizationStatusDenied) {
UIAlertController *alertCtrl = [UIAlertController alertControllerWithTitle:@"打开摄像头失败" message:@"请在 设置-隐私-相机 开启权限" preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
}];
[alertCtrl addAction:cancelAction];
UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
}];
[alertCtrl addAction:okAction];
dispatch_async(dispatch_get_main_queue(), ^{
[sel

最低0.47元/天 解锁文章
1万+

被折叠的 条评论
为什么被折叠?



