- - (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;
- }
- }
iOS 麦克风访问权限
最新推荐文章于 2021-07-23 19:13:29 发布