Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

macOS mojave privacy prompt not appearing when debugging audio app in Qt Creator



  • Hi,

    macOS mojave has security privacy restrictions for many new things including accessing the microphone. See System Preferences -> Security and Privacy -> Privacy

    Unfortunately unless an app is ok'd to access the microphone, audio input on ALL soundcards and sound interfaces is muted (silence) for the app. I'm guessing only signed apps trigger the user prompt to allow audio input access, but this presents a problem when developing and debugging apps in Qt Creator. My audio apps have silence on input!!!

    Has anyone figured out how to debug apps that need to trigger the new mojave privacy prompts? Is there a way to register Qt Creator as an ok app for microphone access? (Assuming that debugged apps inherit Qt Creator's permissions...)

    Command line audio apps work fine since the macOS Terminal can be registered for access to the microphone.


  • Lifetime Qt Champion

    Hi,

    Pretty good question I would recommend posting it on the interest mailing list. You'll find there Qt's developers/maintainers. This forum is more user oriented.



  • Ok, here's how I got debugging working. (I haven't got release builds working yet.)

    • Start QT Creator
    • Load the audio project
    • In the audio project's Info.plist file add two lines
      <key>NSMicrophoneUsageDescription</key>
      <string>(Some description of the audio processing)</string>
    • Compile and start debugging the app. This triggers the mojave security prompt.

    Note that the security prompt seems to use the app name from the following Info.plist field to register the app.
    <key>CFBundleIdentifier</key>
    <string>Company Name.Application Name</string>
    If this is changed, the prompt will reappear the next time the app is debugged.


  • Lifetime Qt Champion

    What you can do is:

    1. build your application
    2. copy the generate Info.plist file in your project sources
    3. Modify the file to contain that additional key
    4. Add QMAKE_INFO_PLIST = $$PWD/Info.plist to your .pro file

    See QMAKE_INFO_PLIST documentation for more details.



  • @SGaist Yes, the Info.plist file is already in place in the resources as you describe. The questions are around how exactly to trigger the mojave security prompt.

    For debugging, the method in my message above seems to work. For Release builds, I suspect the app also needs to be signed (which I definitely can do but just haven't tested yet).

    UPDATE: The same Info.plist lines work for the Release build, without the app signed.


  • Lifetime Qt Champion

    @mjsmithers said in macOS mojave privacy prompt not appearing when debugging audio app in Qt Creator:

    UPDATE: The same Info.plist lines work for the Release build, without the app signed.

    Great !



  • Hi,

    if I run in QtCreator only the debug version (without using debug mode) the system does not ask for microphone access. I can only access the microphone if I start debugging or sign my app with macdeployqt.

    Is there a way to turn this features off?

    Thank you

    Morfio


  • Lifetime Qt Champion

    @Morfio Hi, that's something Apple implemented, you have to go to the system settings in order to allow an application access. However, you should rather do as @mjsmithers did and add the field in the Info.plist file.



  • Hi everyone - to come back a BIT to this topic, I have my Info.plist key / values set., and also in Release mode with the application I work on not signed, I get the prompt and mic input. However - after signing and notarizing through Apple, the microphone does NOT work and I don't get a prompt. I've cleared out Security settings, etc., but it doesn't seem like this gets triggered with the signed version. I start again with the unsigned, and things will work again.
    Has anyone else seen anything similar and ... any luck with a solution?
    Thanks!


Log in to reply