zoukankan      html  css  js  c++  java
  • 访问权限0630 2016

    //相册

    #import <AssetsLibrary/AssetsLibrary.h>

     

     
    1. ALAuthorizationStatus author = [ALAssetsLibraryauthorizationStatus];  
    2.     if (author == kCLAuthorizationStatusRestricted || author ==kCLAuthorizationStatusDenied){  
    3.         //无权限  
    4.     }  

     

    //gzz0630 照相机

        NSString * mediaType = AVMediaTypeVideo;

        AVAuthorizationStatus  authorizationStatus = [AVCaptureDevice authorizationStatusForMediaType:mediaType];

        if (authorizationStatus == AVAuthorizationStatusRestricted|| authorizationStatus == AVAuthorizationStatusDenied) {

            UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"相机访问受限" message:@"请在设置-隐私-相机选项中允许肝胆相照访问你的相机" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles: nil];

            [alertView show];//gzz0630

        }else{}

     

     

    //录音

      AVAudioSession *avSession = [AVAudioSession sharedInstance];

        

        if ([avSession respondsToSelector:@selector(requestRecordPermission:)]) {

            

            [avSession requestRecordPermission:^(BOOL available) {

                

                if (available) {

                    if (self.playVoiceMessage) {

           

                }

                else

                {

                    dispatch_async(dispatch_get_main_queue(), ^{//gzz0630

                        [[[UIAlertView alloc] initWithTitle:@"无法录音" message:@"请在设置-隐私-麦克风选项中允许肝胆相照访问你的麦克风" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil] show];

                    });

                }

            }];

            

        }

  • 相关阅读:
    BZOJ3238 [Ahoi2013]差异 SA+单调栈
    BZOJ2754 [SCOI2012]喵星球上的点名 SA+莫队+树状数组
    Luogu P3251 [JLOI2012]时间流逝 期望dp
    Luogu P3962 [TJOI2013]数字根 st
    BZOJ3619 [Zjoi2014]璀灿光华 构造+dfs
    Codeforces 990G 点分治+暴力
    express基础项目创建
    Node.js 中使用 ES6 中的 import / export 的方法大全
    bootstrap 辅助工具
    python实现FTP服务器
  • 原文地址:https://www.cnblogs.com/gzz2016/p/5630238.html
Copyright © 2011-2022 走看看