CodeScanner icon indicating copy to clipboard operation
CodeScanner copied to clipboard

Crash during setup

Open theodorbjornstad opened this issue 3 years ago • 4 comments

Hi!

I'm seeing some crashes when starting a capture session - on various devices using iOS 15 and iOS 16.

NavigationView {
    VStack {
        CodeScannerView(
            codeTypes: [.qr],
            scanMode: .oncePerCode
        ) { response in
            if case let .success(result) = response {
                onFindQRCode(result.string)
            }
        }
        .padding(.horizontal, 16)
        .padding(.bottom, 24)
        .aspectRatio(1, contentMode: .fit)

        // More view elements
    }
}
NSInvalidArgumentException - *** -[AVCaptureDevice setActiveColorSpace:] Not supported - use activeFormat.supportedColorSpaces
Fatal Exception: NSInvalidArgumentException
0  CoreFoundation                 0x9e88 __exceptionPreprocess
1  libobjc.A.dylib                0x178d8 objc_exception_throw
2  AVFCapture                     0x1c7e0 __102-[AVCaptureFigVideoDevice _setActiveFormat:resetVideoZoomFactorAndMinMaxFrameDurations:sessionPreset:]_block_invoke
3  libdispatch.dylib              0x3fdc _dispatch_client_callout
4  libdispatch.dylib              0x13574 _dispatch_lane_barrier_sync_invoke_and_complete
5  AVFCapture                     0x3a144 -[AVCaptureFigVideoDevice setActiveColorSpace:]
6  Foundation                     0x3f814 -[NSObject(NSKeyValueObservingPrivate) _changeValueForKeys:count:maybeOldValuesDict:maybeNewValuesDict:usingBlock:]
7  Foundation                     0x3f590 -[NSObject(NSKeyValueObservingPrivate) _changeValueForKey:key:key:usingBlock:]
8  Foundation                     0x3e518 _NSSetLongLongValueAndNotify
9  AVFCapture                     0xc6d8 -[AVCaptureSession _updateDeviceActiveFormatsAndActiveConnections]
10 AVFCapture                     0xa0d70 -[AVCaptureSession _buildAndRunGraph:]
11 AVFCapture                     0x6710 -[AVCaptureSession _commitConfiguration]
12 AVFCapture                     0x18b1c -[AVCaptureSession addOutput:]
13 <redacted>                     0x506574 CodeScannerView.ScannerViewController.setupCaptureDevice() + 314 (ScannerViewController.swift:314)
14 <redacted>                     0x506134 closure #1 in CodeScannerView.ScannerViewController.handleCameraPermission() + 251 (ScannerViewController.swift:251)
15 <redacted>                     0x5062d0 closure #1 in CodeScannerView.ScannerViewController.requestCameraAccess(completion:) + 270 (ScannerViewController.swift:270)
16 <redacted>                     0x506390 thunk for @escaping @callee_guaranteed (@unowned Bool) -> () (<compiler-generated>)
17 TCC                            0xd06c ___tcc_server_send_request_authorization_block_invoke.62
18 libdispatch.dylib              0x24b4 _dispatch_call_block_and_release
19 libdispatch.dylib              0x3fdc _dispatch_client_callout
20 libdispatch.dylib              0xb694 _dispatch_lane_serial_drain
21 libdispatch.dylib              0xc1e0 _dispatch_lane_invoke
22 libdispatch.dylib              0x16e10 _dispatch_workloop_worker_thread
23 libsystem_pthread.dylib        0xdf8 _pthread_wqthread
24 libsystem_pthread.dylib        0xb98 start_wqthread

theodorbjornstad avatar Aug 28 '23 17:08 theodorbjornstad

I was not running the latest version. Will re-open if the issue appears after upgrading.

theodorbjornstad avatar Aug 28 '23 17:08 theodorbjornstad

Still an issue.

theodorbjornstad avatar Sep 18 '23 08:09 theodorbjornstad

Hi everyone! Any updates about this crash? You can check this issue https://github.com/mrousavy/react-native-vision-camera/issues/2892 and try to set automaticallyConfiguresCaptureDeviceForWideColor while configuration captureSession

nmalevich avatar Nov 25 '24 12:11 nmalevich

Any resolution for this issue?

Dave-Hayden avatar Jun 24 '25 14:06 Dave-Hayden