首页
IT
登录
6mi
u
盘
搜
搜 索
IT
iOS 麦克风访问权限
iOS 麦克风访问权限
xiaoxiao
2021-12-03
17
- (BOOL)canRecord
{
__block BOOL bCanRecord = YES;
if
([[[UIDevice currentDevice] systemVersion] compare:@
"7.0"
] != NSOrderedAscending)
{
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
if
([audioSession respondsToSelector:
@selector
(requestRecordPermission:)]) {
[audioSession performSelector:
@selector
(requestRecordPermission:) withObject:^(BOOL granted) {
if
(granted) {
bCanRecord = YES;
}
else
{
bCanRecord = NO;
}
}];
}
}
return
bCanRecord;
}
#pragma mark - Audio Recorder √
/*开始录音*/
- (
void
)startToRecord:(id)sender
{
if
(![self canRecord]) {
[[[UIAlertView alloc] initWithTitle:nil
message:[NSString stringWithFormat:@
"%@需要访问您的麦克风。\n请启用麦克风-设置/隐私/麦克风"
, [TIXAAppMonitor sharedMonitor].appName]
delegate:nil
cancelButtonTitle:@
"好"
otherButtonTitles:nil] show];
return
;
}
}
转载请注明原文地址: https://ju.6miu.com/read-680107.html
专利
最新回复
(
0
)