[Interest] [Qt 6.6.1 - MacOS] qt.permissions: Could not find permission plugin for QCameraPermission.

Nuno Santos nuno.santos at imaginando.pt
Fri Jun 7 19:23:48 CEST 2024


Tor,

Setting QMAKE_INFO_PLIST made the trick.

This should be referenced on the documentation though.

Thank you!

Have a great weekend!

Best,

Nuno

> On 7 Jun 2024, at 17:11, Tor Arne Vestbø <Tor.arne.Vestbo at qt.io> wrote:
> 
> If you set QMAKE_INFO_PLIST the permission.prf logic should resolve the required permission plugins automatically. If you have a 6.6.3 or 6.7.x based sample that reproduces that not working please file an issue.
> 
> The part you’re missing is likely the QMAKE_LFLAGS += $$request_flag
> 
> 
> ❯ cat ../../qtbase/mkspecs/modules/qt_plugin_qdarwincamerapermission.pri                                       12s
> QT_PLUGIN.qdarwincamerapermission.TYPE = permissions
> QT_PLUGIN.qdarwincamerapermission.EXTENDS = -
> QT_PLUGIN.qdarwincamerapermission.DEPENDS = core
> QT_PLUGIN.qdarwincamerapermission.CLASS_NAME = QDarwinCameraPermissionPlugin
> QT_PLUGIN.qdarwincamerapermission.module_config = v2 staticlib
> QT_PLUGINS += qdarwincamerapermission
> QT_PLUGIN.qdarwincamerapermission.usage_descriptions = NSCameraUsageDescription
> QT_PLUGIN.qdarwincamerapermission.request_flag = -Wl,-u,_QDarwinCameraPermissionRequest
> 
> ❯ cat ../../qtbase/mkspecs/modules/qt_plugin_qdarwinmicrophonepermission.pri
> QT_PLUGIN.qdarwinmicrophonepermission.TYPE = permissions
> QT_PLUGIN.qdarwinmicrophonepermission.EXTENDS = -
> QT_PLUGIN.qdarwinmicrophonepermission.DEPENDS = core
> QT_PLUGIN.qdarwinmicrophonepermission.CLASS_NAME = QDarwinMicrophonePermissionPlugin
> QT_PLUGIN.qdarwinmicrophonepermission.module_config = v2 staticlib
> QT_PLUGINS += qdarwinmicrophonepermission
> QT_PLUGIN.qdarwinmicrophonepermission.usage_descriptions = NSMicrophoneUsageDescription
> QT_PLUGIN.qdarwinmicrophonepermission.request_flag = -Wl,-u,_QDarwinMicrophonePermissionRequest
> 
>> On 7 Jun 2024, at 18:02, Nuno Santos <nuno.santos at imaginando.pt> wrote:
>> 
>> Tor,
>> 
>> Thanks for your reply. I’m still using QMake
>> 
>> After a long time debugging I have realised that there is some kind of magic involved in using QPermission api.
>> 
>> I have found a qmake script that seems to look at Info.plist and search for the necessary key: qtbase/mkspecs/features/permissions.prf
>> 
>> Also, it seems that a QT_PLUGIN must be set in qmake in order to link the appropriate plugin.
>> 
>> But this is not stated anywhere in the documentation therefore I’m linking the plugin manually:
>> 
>> LIBS += /Users/nsantos/Qt/6.6.3/macos_static/plugins/permissions/libqdarwincamerapermission.a
>> 
>> And I’m registering the plugin manually using: Q_IMPORT_PLUGIN(QDarwinCameraPermissionPlugin)
>> 
>> When running the program I don’t have the same message anymore but it is still complaining about the key not being on the Info.plist when it is.
>> 
>> checking permissions Qt::PermissionStatus::Undetermined
>> qt.permissions: Requesting QCameraPermission requires "NSCameraUsageDescription" in Info.plist
>> 
>> The application is code signed with the camera entitlements:
>> 
>> Executable=/private/tmp/build-vs-Qt_6_6_3_for_macOS_static-Release/VS.app/Contents/MacOS/VS
>> [Dict]
>>      [Key] com.apple.security.device.audio-input
>>      [Value]
>>              [Bool] true
>>      [Key] com.apple.security.device.camera
>>      [Value]
>>              [Bool] true
>> 
>> <?xml version="1.0" encoding="UTF-8"?>
>> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
>> <plist version="1.0">
>> <dict>
>>      <key>CFBundleExecutable</key>
>>      <string>VS</string>
>>      <key>CFBundleGetInfoString</key>
>>      <string>1.6.0</string>
>>      <key>CFBundleIconFile</key>
>>      <string>icon.icns</string>
>>      <key>CFBundleIdentifier</key>
>>      <string>com.imaginando.vs</string>
>>      <key>CFBundlePackageType</key>
>>      <string>APPL</string>
>>      <key>CFBundleShortVersionString</key>
>>      <string>1.6.0</string>
>>      <key>CFBundleSignature</key>
>>      <string>????</string>
>>      <key>CFBundleVersion</key>
>>      <string>1.6.0</string>
>>      <key>NSCameraUsageDescription</key>
>>      <string>You can use camera input to create audio reactive visuals</string>
>>      <key>NSMicrophoneUsageDescription</key>
>>      <string>You can use audio input to create audio reactive visuals</string>
>>      <key>NSPrincipalClass</key>
>>      <string>NSApplication</string>
>>      <key>NSSupportsAutomaticGraphicsSwitching</key>
>>      <true/>
>> </dict>
>> </plist>
>> 
>> What am I missing?
>> 
>> Thanks!
>> 
>> Regards,
>> 
>> Nuno
>> 
>>> On 7 Jun 2024, at 16:32, Tor Arne Vestbø <Tor.arne.Vestbo at qt.io> wrote:
>>> 
>>> Is the problem there in v6.6.3 as well? qmake or CMake based project?
>>> 
>>> Tor Arne
>>> 
>>>> On 7 Jun 2024, at 16:44, Nuno Santos via Interest <interest at qt-project.org> wrote:
>>>> 
>>>> Hi,
>>>> 
>>>> I’m trying to use the new QPermissions API on Qt 6.6.1 on a Mac but I’m having a problem.
>>>> 
>>>> Even the app is code signed, has the necessary NSCameraUsageDescription on the Info.plist I always get the following message:
>>>> 
>>>> qt.permissions: Could not find permission plugin for QCameraPermission. Please make sure you have included the required usage description in your Info.plist
>>>> 
>>>> I’ve looked to the source code and it seems that it tried to load a plugin and this message is only shown when the plugin is not found.
>>>> 
>>>> I’ve also checked the qt build to see if the lib was around.
>>>> 
>>>> Am I missing something?
>>>> 
>>>> Thanks!
>>>> 
>>>> Regards
>>>> 
>>>> Nuno
>>>> _______________________________________________
>>>> Interest mailing list
>>>> Interest at qt-project.org
>>>> https://lists.qt-project.org/listinfo/interest
>>> 
>> 
> 



More information about the Interest mailing list