摄像头监測是否“授权”
时间:2017-06-17 21:20:31
收藏:0
阅读:348
ios7苹果公司增加了摄像头隐私设置选项:
在app中监測手机摄像头是否授权给APP:
#define PHOTOGRAPH_ACCREDIT \
if(VALID_VERSION(7.0)){\if(!([AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo] == AVAuthorizationStatusAuthorized)){\
UIAlertView * alt = [[UIAlertView alloc] initWithTitle:@"未获得授权使用摄像头" message:@"请在iOS\"设置中\"-\"隐私\"-\"相机\"中打开" delegate:self cancelButtonTitle:nil otherButtonTitles:@"知道了", nil];\
[alt show];\
return;\
}\
}
我写了一个宏,在调用摄像头的地方前面增加(PHOTOGRAPH_ACCREDIT;),若没有在系统“设置”-“隐私”开启摄像头就会有这种效果:
原文:http://www.cnblogs.com/tlnshuju/p/7041217.html
评论(0)