Home > Software engineering >  Delphi MacOS request permission to use microphone
Delphi MacOS request permission to use microphone

Time:12-12

Delphi 11 project on MacOS is asking permission using this code:

procedure TCOWMainForm.Button1Click(Sender: TObject);
var
  fMic: FMX.Media.TAudioCaptureDevice;
begin
  fMic := TAVCaptureDeviceManager.Current.DefaultAudioCaptureDevice;
  if (fMic <> nil) then
  begin
    ShowMessage('fMic not nil so calling fMic.RequestPermission');
    fMic.RequestPermission;
  end;
end;

Project | Options | Version Info includes a key pair of NSMicrophoneUsageDescription "COW records your voice."

Still, the project is killed when it calls fMic.RequestPermission, as per Apple documentation:

Requesting Authorization for Media Capture on macOS

What might I be missing in attempting to get permission to use the microphone in a macOS notarized app?

Edited to include this Embarcadero RSP which has a minimal project that reproduces the issue.

https://quality.embarcadero.com/browse/RSP-36541

CodePudding user response:

Thanks to @DaveNottage it appears that a notarized Delphi app does need more than the NSMicrophoneUsageDescription key pair in the Info.plist.

The project also needs Project | Options | Application | Entitlement List | Audio Input to be checked True.

  • Related