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

iOS 判断应用是否有使用相机的权限

时间:2015-01-15 14:18:49      阅读:203      评论:0      收藏:0      [点我收藏+]

标签:ios   ios资源   access   

iOS  判断应用是否有使用相机的权限

 NSString *mediaType = AVMediaTypeVideo;

        AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:mediaType];

        if(authStatus == ALAuthorizationStatusRestricted || authStatus == ALAuthorizationStatusDenied){

NSLog(@"相机权限受限");

            return;

        }

-------

全部状态

typedef NS_ENUM(NSInteger, ALAuthorizationStatus) {

    ALAuthorizationStatusNotDetermined = 0, // User has not yet made a choice with regards to this application

    ALAuthorizationStatusRestricted,        // This application is not authorized to access photo data.

                                            // The user cannot change this application’s status, possibly due to active restrictions

                                            //  such as parental controls being in place.

    ALAuthorizationStatusDenied,            // User has explicitly denied this application access to photos data.

    ALAuthorizationStatusAuthorized         // User has authorized this application to access photos data.

} __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_6_0);



注意:要添加 AVFoundation 库。


iOS 判断应用是否有使用相机的权限

标签:ios   ios资源   access   

原文地址:http://blog.csdn.net/miaoshichang/article/details/42740305

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