zoukankan      html  css  js  c++  java
  • 摄像头监測是否“授权”

    ios7苹果公司增加了摄像头隐私设置选项:

    在app中监測手机摄像头是否授权给APP:

    #define PHOTOGRAPH_ACCREDIT

        if(VALID_VERSION(7.0)){
            if(!([AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo] == AVAuthorizationStatusAuthorized)){
                    UIAlertView * alt = [[UIAlertView alloc] initWithTitle:@"未获得授权使用摄像头" message:@"请在iOS"设置中"-"隐私"-"相机"中打开" delegate:self cancelButtonTitle:nil otherButtonTitles:@"知道了", nil];
                    [alt show];
                    return;
            }

        }


    我写了一个宏,在调用摄像头的地方前面增加(PHOTOGRAPH_ACCREDIT;),若没有在系统“设置”-“隐私”开启摄像头就会有这种效果:

                                                                                             

  • 相关阅读:
    Evanyou Blog 彩带
    Evanyou Blog 彩带
    Evanyou Blog 彩带
    Evanyou Blog 彩带
    Evanyou Blog 彩带
    Evanyou Blog 彩带
    Evanyou Blog 彩带
    Evanyou Blog 彩带
    Evanyou Blog 彩带
    Evanyou Blog 彩带
  • 原文地址:https://www.cnblogs.com/tlnshuju/p/7041217.html
Copyright © 2011-2022 走看看