[Interest] Issues when requesting access to use the Microphone on macOS

Sley HORTES sleyhortes13 at gmail.com
Wed May 8 16:44:43 CEST 2024


Hello All, Hope You are doing fine.

I am all new to Qt and this email is  concerning an issue that I have had lately regarding a chat application which requests access to use the Microphone. 

I have read the Documentation on how to handle it. I have written exactly what they said but I didn’t receive the popup message which request access to the microphone. The function where I tried to do so is below, the Info.plist file command along with the terminal message that is prompted when trying to use it.

Function:

void client_chat_window::start_recording()
{
    QMicrophonePermission microphonePermission;

    switch (qApp->checkPermission(microphonePermission))
    {
    case Qt::PermissionStatus::Undetermined:
        qApp->requestPermission(microphonePermission, this, [=]()
                                { qDebug() << "Undetermined: Microphone permission granted!"; });

        std::cout << std::endl;
        break;

    case Qt::PermissionStatus::Denied:
        qApp->requestPermission(microphonePermission, this, [=]()
                                { qDebug() << "Asking permission within the Denied case"; });

        qWarning("Denied: Microphone permission is not granted!");
        std::cout << std::endl;
        break;

    case Qt::PermissionStatus::Granted:
        QMediaCaptureSession session;

        QAudioInput audioInput;
        session.setAudioInput(&audioInput);

        QMediaRecorder recorder;
        session.setRecorder(&recorder);

        recorder.setQuality(QMediaRecorder::HighQuality);
        recorder.setOutputLocation(QUrl::fromLocalFile("test.mp3"));
        recorder.record();
        qDebug() << "Recording started!";

        std::cout << std::endl;
        break;
    }
}


Within the Info.plist, I've written this:
<key>NSMicrophoneUsageDescription</key>
<string>We need access to your microphone to record audio for voice chat.</string>


CMakeLists.txt file related to the app:
add_executable(client
client_main.cpp
client_main_window.cpp
client_manager.cpp
client_chat_window.cpp
chat_protocol.cpp
chat_line.cpp
)
target_link_libraries(client PRIVATE database_library)

qt_add_resources(client "images"
PREFIX "/images"
FILES send_icon.png
)

set(MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist)

set_target_properties(client PROPERTIES MACOSX_BUNDLE ON)



Terminal Message:
qt.permissions: Could not find permission plugin for QMicrophonePermission. Please make sure you have included the required usage description in your Info.plist

I really Hope That You will spot where I went wrong and give me an hint on how to solve it. 
Thanks.




> On May 5, 2024, at 5:59 AM, interest-request at qt-project.org wrote:
> 
> Welcome to the Interest at qt-project.org mailing list!
> 
> To post to this list, send your message to:
> 
>  interest at qt-project.org
> 
> General information about the mailing list is at:
> 
>  https://lists.qt-project.org/listinfo/interest
> 
> If you ever want to unsubscribe or change your options (eg, switch to
> or from digest mode, change your password, etc.), visit your
> subscription page at:
> 
>  https://lists.qt-project.org/options/interest/sleyhortes13%40gmail.com
> 
> 
> You can also make such adjustments via email by sending a message to:
> 
>  Interest-request at qt-project.org
> 
> with the word `help' in the subject or body (don't include the
> quotes), and you will get back a message with instructions.
> 
> You must know your password to change your options (including changing
> the password, itself) or to unsubscribe without confirmation.  It is:
> 
>  c5x3KgHZbCTv3HJ
> 
> Normally, Mailman will remind you of your qt-project.org mailing list
> passwords once every month, although you can disable this if you
> prefer.  This reminder will also include instructions on how to
> unsubscribe or change your account options.  There is also a button on
> your options page that will email your current password to you.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20240508/695b792a/attachment.htm>


More information about the Interest mailing list