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];
                });
            }
        }];
    }
  • 相关阅读:
    公司的CMS参数
    Kafka 如何保证消息可靠性
    我来了
    spring解决乱码
    mybatis反向工程
    Unicode控制字符
    功能跟进记录
    创建IDataProvider实例
    腾讯2016研发工程师笔试题36车 6跑道 没有计时器 最少要几次取前三
    .net mvc下拉列表DropDownList控件绑定数据
  • 原文地址:https://www.cnblogs.com/-ios/p/4670000.html
Copyright © 2011-2022 走看看