判断是否获取到手机相机权限

  实际运用场景:

上传图片,查看相机设备,使用相机 在做这些操作的时候先调用这段话

 

AVAuthorizationStatus authStatus =  [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];

    if (authStatus == AVAuthorizationStatusRestricted || authStatus ==AVAuthorizationStatusDenied)

    {

        UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"提示" message:@"未获得授权使用相机,请在iOS\"设置中\"-\"隐私\"-\"相机\"中打开" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil];

        [alertView show];

        return;

    }

posted on 2017-11-09 10:30  廖利君  阅读(1162)  评论(0编辑  收藏  举报