zoukankan      html  css  js  c++  java
  • 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(受限制:已经询问过是否获得许可但被拒绝)");
        }

    祝您愉快开心 ^_^

  • 相关阅读:
    bzoj2818
    bzoj1901
    bzoj1010
    loj6277
    bzoj1001
    bzoj1787
    选项卡
    日期选择器
    去掉文本框的外边框
    bootstarp 模态框大小尺寸的控制
  • 原文地址:https://www.cnblogs.com/tianglin/p/3471021.html
Copyright © 2011-2022 走看看