Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
vlack-coder opened this issue Apr 4, 2025 · 4 comments

Comments

@vlack-coder
Copy link

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.

@vlack-coder
Copy link
Author

vlack-coder commented Apr 4, 2025

Hi @scarlac , Please can you help with this. I use Version 13.0.0

Image

The above is the logs on the Crashlytics console and these are the major crash in our app.
I cannot recreate it on my end.

Issue is recorded on devices from
iPhone 6 to iPhone 15
iOS 15 to 18

@vlack-coder vlack-coder changed the title Crashes in Camera on iOS caused by setupCaptureSession AVCaptureSession addInput() Crashes on iOS caused by setupCaptureSession AVCaptureSession addInput() Apr 5, 2025
@vlack-coder
Copy link
Author

@phlpsong @scarlac please do you have any idea why I'm getting this crash. Any suggestion would be appreciated

@scarlac
Copy link
Collaborator

scarlac commented Apr 22, 2025

Are you able to reproduce yourself? I've looked at this before but I don't quite see how it happens

@scarlac
Copy link
Collaborator

scarlac commented Apr 23, 2025

Also, can you please try upgrading to v14? I believe it was fixed (through the rewrite)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants