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{
}
原文地址:http://blog.csdn.net/u013020103/article/details/46560105