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

    祝您愉快开心 ^_^

  • 相关阅读:
    python基本数据类型之整型和浮点型
    Java学习路线
    Linux学习笔记之VIM
    Java基础之流程控制
    Linux学习笔记之Shell
    Java基础之数据类型
    论文提交说明
    IDEA安装教程
    Link summary for writing papers
    1 类基础知识
  • 原文地址:https://www.cnblogs.com/tianglin/p/3471021.html
Copyright © 2011-2022 走看看