zoukankan      html  css  js  c++  java
  • 判断用户是否禁止该App使用设备麦克风

    #import <AVFoundation/AVAudioSession.h>

    ...
    if ([[AVAudioSession sharedInstance] respondsToSelector:@selector(requestRecordPermission:)]) {
        [[AVAudioSession sharedInstance] performSelector:@selector(requestRecordPermission:) withObject:^(BOOL granted) {
            if (granted) {
                // Microphone enabled code
                NSLog(@"Microphone is enabled..");
            }
            else {
                // Microphone disabled code
                NSLog(@"Microphone is disabled..");
     
                // We're in a background thread here, so jump to main thread to do UI work.
                dispatch_async(dispatch_get_main_queue(), ^{
                    [[[[UIAlertView alloc] initWithTitle:@"Microphone Access Denied"
                                            message:@"This app requires access to your device's Microphone. Please enable Microphone access for this app in Settings / Privacy / Microphone"
                                           delegate:nil
                                  cancelButtonTitle:@"Dismiss"
                                  otherButtonTitles:nil] autorelease] show];
                });
            }
        }];
    }
  • 相关阅读:
    分享微云普通用户不限速下载方法
    PS基础之移动工具和分布对齐
    操作系统的概念、功能和目标
    又拍云+PicGo搭建图床教程
    05 数组
    04 循环结构
    02 数据类型_变量_运算符_表达式
    03 流程控制
    05 方法_递归
    win7下使用telnet的方法
  • 原文地址:https://www.cnblogs.com/-ios/p/4670000.html
Copyright © 2011-2022 走看看