Maximilian Körner
Maximilian Körner

Reputation: 894

Microphone permission not working as intended

I'm working on an app which requires microphone access/recording. Until now i thought my permission handling is working, but my TestFlight beta testers can not use the microphone feature even though it is working in the simulator and iOS7 test devices.

Here is my permission code:

AVAudioSession *session = [AVAudioSession sharedInstance];
    if ([session respondsToSelector:@selector(requestRecordPermission:)]) {
        [session performSelector:@selector(requestRecordPermission:) withObject:^(BOOL granted) {
            if (granted) {
                //granted
            }
            else {
                //not granted
                }
        }
        ];
    }else{
        //iOS6 seems to be missing this feature -> always available
    }

I am unable to reproduce the prompt, even with reset privacy and location on the simulator, means the prompt never shows up. Nevertheless i can work with the microphone on the simulator as if the permission was granted.

One important thing is, that the app is NOT listed under Privacy as an microphone accessing app (which it obviously should).

If i print the iOS8 flag [AvAudioSession sharedInstance].recordPermission it is always AVAudioSessionRecordPermissionUndetermined even after the above permission request finished with granted.

A short piece of test code:

[[AVAudioSession sharedInstance] requestRecordPermission:^(BOOL granted) {
        NSLog(@"GRANTED: %i", granted);
    }];
    NSLog(@"RECORD PERMISSION: %i", [AVAudioSession sharedInstance].recordPermission == AVAudioSessionRecordPermissionUndetermined?1:0);

produces for me the output: "GRANTED: 1""RECORD PERMISSION: 1" which should be impossible, right?

This makes it currently unable to use my app under iOS8.

Upvotes: 3

Views: 2346

Answers (1)

Simon Tillson
Simon Tillson

Reputation: 3618

The simulator doesn't do the permission prompt for microphone access, or list them under Privacy. It simply allows the audio recording to work. You must test this on a real device I'm afraid.

Related answer: requestRecordPermission does nothing

Upvotes: 2

Related Questions