• iOS摄像头问题


    国行iPhone在iOS7下获取摄像头需要进行认证,或者手动在iPhone的“设置”里对你的App开启摄像头。

    在你不知道你的App是否能打开摄像头的之前,你可以根据API获取摄像头状态:

    typedef enum : NSInteger {
       AVAuthorizationStatusNotDetermined = 0,
       AVAuthorizationStatusRestricted,
       AVAuthorizationStatusDenied,
       AVAuthorizationStatusAuthorized
    } AVAuthorizationStatus;
    // Check camera status
        AVAuthorizationStatus cameraStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
        if (cameraStatus == AVAuthorizationStatusDenied) {
            NSLog(@"Denied(被拒绝了,不能打开)");
        } else if (cameraStatus == AVAuthorizationStatusAuthorized) {
            NSLog(@"Authorized(已经获得了许可)");
        } else if (cameraStatus == AVAuthorizationStatusNotDetermined) {
            NSLog(@"Not Determined(不确定是否获得了许可)");
        } else if (cameraStatus == AVAuthorizationStatusRestricted) {
            NSLog(@"Restricted(受限制:已经询问过是否获得许可但被拒绝)");
        }

    祝您愉快开心 ^_^

  • 相关阅读:
    python
    突然萌发关于 redis 的想法(1)
    Liunx
    Git
    说一下数据库查询 和 分页问题的解决
    易忘点
    python
    python
    python
    python
  • 原文地址:https://www.cnblogs.com/tianglin/p/3471021.html
Copyright © 2020-2023  润新知