iOS怎么判断应用是否开启摄像头权限
www.MyException.Cn 网友分享于:2015-06-21 浏览:0次
iOS如何判断应用是否开启摄像头权限
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{
}本回答被提问者采纳