1 判断是否允许使用相机:
NSString *mediaType = AVMediaTypeVideo;
AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:mediaType];
if(authStatus == ALAuthorizationStatusRestricted ||
authStatus == ALAuthorizationStatusDenied){
[Utils showAlertView:nil :@"请在iPhone的“设置-隐私-相机”选项中,允许轻轻访问您的手机相机。" :@"我知道了"];
return;
}
2 判断是否允许使用相册:
ALAuthorizationStatus author = [ALAssetsLibrary authorizationStatus];
if (author == ALAuthorizationStatusRestricted ||
author == ALAuthorizationStatusDenied) {
// 用户不允许应用访问相册
[Utils showAlertView:nil :@"请在iPhone的“设置-隐私-照片”选项中,允许轻轻访问您的手机相册。" :@"我知道了"];
return;
}