码迷,mamicode.com
首页 > 移动开发 > 详细

iOS如何判断应用是否开启摄像头权限

时间:2015-06-19 13:35:12      阅读:166      评论:0      收藏: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{

}

iOS如何判断应用是否开启摄像头权限

标签:摄像头   ios   

原文地址:http://blog.csdn.net/u013020103/article/details/46560105

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!