zoukankan      html  css  js  c++  java
  • 获取当前相机的权限

       if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera])
        {
            //获取当前的授权状态
            AVAuthorizationStatus AVStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
            
            //只要没有拒绝
            if (AVStatus != AVAuthorizationStatusDenied) {
                UIImagePickerController *pickerVc = [[UIImagePickerController alloc] init];
                pickerVc.delegate = self;
                //设置拍照后的图片可被编辑
                pickerVc.allowsEditing = YES;
                pickerVc.sourceType = UIImagePickerControllerSourceTypeCamera;
                _pickerVc = pickerVc;
                [self presentViewController:pickerVc animated:YES completion:nil];
            }else{

        //如果已经拒绝

        //弹出提示框
                UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"请在iPhone的“设置-隐私-相机”选项中,允许***访问你的相机" message:nil preferredStyle:UIAlertControllerStyleAlert];
                UIAlertAction *photoesAction = [UIAlertAction actionWithTitle:@"好" style:0 handler:^(UIAlertAction * _Nonnull action) {
                }];
                [alertController addAction:photoesAction];
                [self presentViewController:alertController animated:YES completion:nil];
            }
            
        }else
        {
            BCJLog(@"模拟器无法打开照相机,请在真机中使用");
        }

  • 相关阅读:
    团队项目——需求规格说明书
    UML
    第二次团队作业——预则立&&他山之石
    团队选题报告
    团队展示
    ubuntu下使用pyinstaller将python文件打包成exe(py文件中含有keras框架的代码)
    ubuntu 为项目配置虚拟环境
    安装cuda9.0 + cudnn7.0 与 cuda8.0共存
    ubuntu 16.04 + cuda8.0 + cudnn 6.1 + tensorflow 1.4.0
    修改vs2013中MFC项目名称
  • 原文地址:https://www.cnblogs.com/LiRenee/p/5379855.html
Copyright © 2011-2022 走看看