首页 > 移动平台 > 详细

判断用户是否禁止该App使用设备麦克风

时间:2015-07-23 11:52:39      阅读:223      评论:0      收藏:0      [点我收藏+]

#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.\n\nPlease enable Microphone access for this app in Settings / Privacy / Microphone"
                                       delegate:nil
                              cancelButtonTitle:@"Dismiss"
                              otherButtonTitles:nil] autorelease] show];
            });
        }
    }];
}

判断用户是否禁止该App使用设备麦克风

原文:http://www.cnblogs.com/-ios/p/4670000.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!