UIImagePickerController crashes on M2 Mac

if UIImagePickerController.isSourceTypeAvailable(.camera) {
            
    let imagePicker = UIImagePickerController()
    imagePicker.delegate = self
    imagePicker.allowsEditing = false
    imagePicker.sourceType = .camera
            
    self.present(imagePicker, animated: true, completion: nil)
}

this code crashes on M2 Mac (Designed for iPad) with the following exception

<<<< FigCaptureCameraParameters >>>> Fig assert: "success" at bail (FigCaptureCameraParameters.m:249) - (err=0) An uncaught exception was raised *** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0] ( 0 CoreFoundation 0x0000000180b02800 __exceptionPreprocess + 176 1 libobjc.A.dylib 0x00000001805f9eb4 objc_exception_throw + 60 2 CoreFoundation 0x0000000180a1a724 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 728 3 CoreFoundation 0x0000000180a1a420 +[NSDictionary dictionaryWithObjects:forKeys:count:] + 52 4 AVFCapture 0x000000019de90374 -[AVCaptureFigVideoDevice _cameraInfo] + 200 5 AVFCapture 0x000000019de90278 -[AVCaptureFigVideoDevice updateStreamingDeviceHistory] + 36 6 AVFCapture 0x000000019deec8c0 -[AVCaptureSession _startFigCaptureSession] + 464 7 AVFCapture 0x000000019def0980 -[AVCaptureSession _buildAndRunGraph:] + 1936 8 AVFCapture 0x000000019deecc00 -[AVCaptureSession _setRunning:] + 120 9 AVFCapture 0x000000019deec46c -[AVCaptureSession startRunning] + 452 10 libRPAC.dylib 0x00000001051c9024 _replacement_AVCaptureSession_startRunning + 104 11 libdispatch.dylib 0x000000010509cf14 _dispatch_call_block_and_release + 32 12 libdispatch.dylib 0x000000010509eb4c _dispatch_client_callout + 20 13 libdispatch.dylib 0x00000001050a7cd8 _dispatch_lane_serial_drain + 864 14 libdispatch.dylib 0x00000001050a8dcc _dispatch_lane_invoke + 416 15 libdispatch.dylib 0x00000001050b877c _dispatch_root_queue_drain_deferred_wlh + 652 16 libdispatch.dylib 0x00000001050b7a54 _dispatch_workloop_worker_thread + 444 17 libsystem_pthread.dylib 0x0000000105147d9c _pthread_wqthread + 288 18 libsystem_pthread.dylib 0x000000010514fab4 start_wqthread + 8 )

It works when I connect an iPhone to the mac as a camera. If I then disconnect the iPhone again, the app crashes again. An additional check with UIImagePickerController.isCameraDeviceAvailable returns true.

CMIOHardware.cpp:124:CMIOObjectHasProperty no object with given ID 666 CMIOHardware.cpp:150:CMIOObjectHasProperty Error: 560947818, failed *** Terminating app due to uncaught exception 'NSInvalidArgumentException',

Any new info ? I have some condition with my Mac M1.

UIImagePickerController crashes on M2 Mac
 
 
Q