iOS原生OC申请麦克风权限

 

AVAuthorizationStatus microPhoneStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeAudio];
    switch (microPhoneStatus) {
        case AVAuthorizationStatusDenied:
        case AVAuthorizationStatusRestricted:
        {
            NSLog(@"iOS原生 被拒绝  . . .");
        }
            break;
        case AVAuthorizationStatusNotDetermined:
        {
            NSLog(@"iOS原生 没弹窗  . . .");
        }
            break;
        case AVAuthorizationStatusAuthorized:
        {
            NSLog(@"iOS原生 有授权  . . .");
        }
            break;

        default:
            break;
    }
   
    [AVCaptureDevice requestAccessForMediaType:AVMediaTypeAudio completionHandler:^(BOOL granted) {
        NSLog(@"iOS原生 是否同意  . . .");
        //callback(@"code");
    }];

 

posted @ 2020-07-19 20:47  野生野鸡码农  阅读(1054)  评论(0编辑  收藏  举报