3

Is it possible to check the record permission status (if it is granted or not) without initiating standard iOS request flow?

For example, if I would like to know if record permission is granted, but without calling -requestRecordPermission on [AVAudioSession sharedInstance] which will make iOS present prompt to the user about allowing access to the microphone.

I am looking something similar to the CLLocationManager's authorizationStatus kCLAuthorizationStatusNotDetermined

Thanks

Miroslav Kovac
  • 1,168
  • 1
  • 16
  • 27
  • This seems to be lacking in the API. Another user [asked the same question](http://stackoverflow.com/questions/19615105/check-for-mic-permission-on-ios-7-without-showing-prompt?rq=1) with no replies. Submit an enhancement request to Apple. – rmaddy Jul 15 '14 at 17:26

2 Answers2

3

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.

Mr. T
  • 12,795
  • 5
  • 39
  • 47
1

Swift answer:

if AVAudioSession.sharedInstance().recordPermission() == .Denied {
    MKAlertViewController().instantaneousAlert(title: "Erreur", message: "Vous n'avez pas autorisé l'application à accéder au micro")
}
Floris M
  • 1,764
  • 19
  • 18