Skip to content

Instantly share code, notes, and snippets.

@akinLiu
Created May 20, 2014 15:26
Show Gist options
  • Save akinLiu/9bc270cadb4d005f43c3 to your computer and use it in GitHub Desktop.
Save akinLiu/9bc270cadb4d005f43c3 to your computer and use it in GitHub Desktop.
检测麦克风可用状态
if ([[AVAudioSession sharedInstance] respondsToSelector:@selector(requestRecordPermission:)]) {
[[AVAudioSession sharedInstance] requestRecordPermission:^(BOOL granted) {
if (!granted) {
//检测到不可用
dispatch_async(dispatch_get_main_queue(), ^{
//回到主线程做出相应提示
});
}
}];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment