判断用户是否禁止该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.\n\nPlease enable Microphone access for this app in Settings / Privacy / Microphone" delegate:nil cancelButtonTitle:@"Dismiss" otherButtonTitles:nil] autorelease] show]; }); } }];}posted on 2015-07-23 11:45 yucaijiang 阅读(503) 评论(0) 收藏 举报
浙公网安备 33010602011771号