Skip to content

Crashes on iOS caused by setupCaptureSession AVCaptureSession addInput() #714

Open
@vlack-coder

Description

@vlack-coder

Describe the bug
Never experienced it personally but on Firebase Crashlytics console, I get --->
i get 2 separate error due to setupCaptureSession

  1. setupCaptureSession() - SIGSEGV (Segmentation Fault) ----> __31-[CKCamera setupCaptureSession]_block_invoke (Line 364 in CKCamera.m)
  2. setupCaptureSession() - SIGTRAP (Trap Exception) ---> __31-[CKCamera setupCaptureSession]_block_invoke (Line 354 in CKCamera.m)
  3. AVCaptureSession addInput() - NSInvalidArgumentException ---> NSInvalidArgumentException - *** -[AVCaptureSession addInput:] Can't add a nil AVCaptureInput - _25-[CKCamera changeCamera:]_block_invoke (Line 638 in CKCamera.m)

The crashlytics console is referencing the 3 lines below
Line 354 in CKCamera.m
Image
Line 368 in CKCamera.m
Image
Line 638
Image

To Reproduce
Steps to reproduce the behavior:
I use only the Back Camera and IT'S USED for scanning QR CODE. and I've also disabled switching btw back and front
My Code

      <View style={[styles.cameraContainer]}>
              {noCamera ? (
                <View>
                  {/* {noCamera && CameraDeniedAlert} */}
                </View>
              ) : 
              doScanBarcode &&
                isfocused &&
                !isModalVisible &&
                !isVerifyLoading &&
                !isGhVerifyLoading ? (
                <Camera
                  ref={cameraRef}
                  style={styles.cameraPreview}
                  cameraType={cameraType}
                  zoomMode="on"
                  focusMode="on"
                  laserColor="transparent"
                  scanBarcode={!isModalVisible && doScanBarcode ? true : false}
                  onReadCode={(event: any) => {
                    setDoScanBarcode(false);
                  }}
                  torchMode={torchMode ? "on" : "off"}
                />
              ) : (
                <View />
              )}
            </View>
  const noCamera =
    cameraPermissionStatus === "denied" ||
    cameraPermissionStatus === "blocked" ||
    cameraPermissionStatus === null;

Expected behavior
Not Crash

Screenshots
If the issue is a visual glitch or UI issue please provide screen shots

  • OS: Only on iOS
  • Browser [e.g. chrome, safari]
  • Version 13.0.0

Smartphone (please complete the following information):

  • Device: iPhone 15 pro
  • OS: iO8 18.4
  • Version 13.0.0

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions