Curious, when it crashes like that, are you in the debugger?
When I use the camera in Qt on OSX, in normal run mode, it works. Only when I . use the debugger it crashes with the permission message.
 
Also, what are you doing to provide the application PLIST? I have not done that successfully apparently.
 
Sent: Thursday, January 09, 2020 at 12:03 PM
From: "Nuno Santos" <nunosan...@imaginando.pt>
To: "interestqt-project.org" <interest@qt-project.org>
Subject: [Interest] Mac OS - AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo crashes application
Hi,
 
I’m trying to setup camera usage permission request for 10.14 (Mojave) and 10.15 (Catalina). I have added the camera and microphone permissions in the Info.plist as in below:
 
<key>NSCameraUsageDescription</key>
<string>This application uses the video camera to communicate with another endpoint.</string>
<key>NSMicrophoneUsageDescription</key>
<string>This application uses the microphone input to communicate with another endpoint.</string>
 
But the app keeps crashing as soon as the permission code below is called when it should prompt for permissions:
 
void CameraManager::requestCameraUsagePermission()
{
    switch([AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo])
    {
        case AVAuthorizationStatusAuthorized:
            _isCameraUsageAllowed = true;
            break;
        case AVAuthorizationStatusNotDetermined:
            // crashes as soon this line is called
            [AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted)
            {
            }];
            break;
        case AVAuthorizationStatusRestricted:
            _isCameraUsageAllowed = false;
            break;
        case AVAuthorizationStatusDenied:
            _isCameraUsageAllowed = false;
    }
}
 
The most curious thing is that ifI run the app from the terminal it actually prompts with "Terminal" would like to access the camera.
 
Has anyone gone through this problem? 
 
I’m getting crazy as this is a very well documented and I’ve triple checked everything without success.
 
Thanks!
 
Nuno
_______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to