Miroslav Kovac Miroslav Kovac - 3 months ago 20
iOS Question

Check AVAudioSession record permission status

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

Answer

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.

Comments