iOS 判断应用是否有使用相机的权限
2015-01-15 13:55
471 查看
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 库。
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 判断相机权限是否被限制,判断相机是否可以使用
- iOS判断是否有权限访问相机,相册,定位
- iOS判断是否有权限访问相机,相册,定位
- 判断Android应用是否打开了使用网络权限
- iOS~判断应用是否有定位权限
- iOS判断应用是否获取到系统相机 相册的授权 以及如何请求授权
- 请教一个问题,Android应用运行时在调用某个API(比如相机)时,系统如何判断这个应用是否具备相应的权限?
- iOS判断是否有权限访问相机,相册,定位
- iOS如何判断应用是否开启摄像头权限
- ios 判断是否有权限访问相机,相册,定位
- 判断iOS应用是否开放HTTP权限的方法
- iOS-判断相册,相机,定位权限是否打开
- iOS iOS判断是否有权限访问相机,相册,定位
- iOS判断是否有权限访问相机,相册,定位
- 判断应用是否有访问相册和相机的权限
- iOS 判断相机权限是否被限制
- 请教一个问题,Android应用运行时在调用某个API(比如相机)时,系统如何判断这个应用是否具备相应的权限?
- 请教一个问题,Android应用运行时在调用某个API(比如相机)时,系统如何判断这个应用是否具备相应的权限?