Check for mic permission on iOS 7 without showing prompt
Asked Answered
S

1

3

The only documented method for checking mic permission on iOS 7 that I could find is requestRecordPermission documented on AVAudioSession. https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVAudioSession_ClassReference/Reference/Reference.html#//apple_ref/occ/instm/AVAudioSession/requestRecordPermission:

However, the very act of checking permission using this method will display an alert asking user for permission if user hasn't already made a decision, which can be very undesirable. Is there a work around to check mic permission without showing a prompt?

Skees answered 27/10, 2013 at 5:53 Comment(0)
N
7

In iOS 8, they added a new property to AVAudioSession:

[AVAudioSession sharedInstance].recordPermission

That returns a AVAudioSessionRecordPermission:

enum {
   AVAudioSessionRecordPermissionUndetermined     = 'undt',
   AVAudioSessionRecordPermissionDenied           = 'deny',
   AVAudioSessionRecordPermissionGranted          = 'grnt'
};
typedef NSUInteger  AVAudioSessionRecordPermission;

But there doesn't seem to be a way in iOS 7.

Nutmeg answered 15/10, 2014 at 22:42 Comment(1)
It looks like there is a way to check this on both iOS 7 and 8: https://mcmap.net/q/160496/-ios-check-if-application-has-access-to-microphoneSalver

© 2022 - 2024 — McMap. All rights reserved.