Skip to content

NSGenericException crash on iOS 26 — startRunning may not be called between beginConfiguration and commitConfiguration during CameraEnhancer.open() #59

Description

@marijam26

Summary

On iOS 26 only, the app crashes intermittently with a fatal NSGenericException thrown from -[AVCaptureSession startRunning] inside DynamsoftCameraEnhancer.framework. It happens when starting the barcode scanner (CameraEnhancer.open() + CaptureVisionRouter.startCapturing()). We have zero occurrences on any iOS < 26.

Environment

  • dynamsoft-capture-vision-react-native: 3.4.3010
  • React Native: 0.83 (Expo SDK 55)
  • New Architecture: Enabled
  • Affected OS: iOS 26.0 / 26.5 / 26.5.2 (never on earlier iOS)
  • Devices: iPhone 17-class (iPhone18,2), high-end, arm64
  • Frequency: Intermittent — 14 events / 5 users over ~7 weeks

Exception

NSGenericException: *** -[AVCaptureSession startRunning] startRunning may not be
called between calls to beginConfiguration and commitConfiguration

Crashed thread (symbols stripped for app frames; the throw is inside the framework's camera queue):

_dispatch_call_block_and_release
  <DynamsoftCameraEnhancer.framework>
    -[AVCaptureSession startRunning]
      objc_exception_throw
        __exceptionPreprocess

mechanism: nsexception, handled: no, level: fatal. Because it's thrown asynchronously on the SDK's own capture-session queue, it cannot be caught with @try/@catch around the exported RN methods.

How we call the SDK

The CameraEnhancer / CaptureVisionRouter are singletons. On mount we bind the view, open the camera, then start capturing:

CaptureVisionRouter.getInstance().setInput(CameraEnhancer.getInstance());
// ...
camera.setCameraView(view);
camera.open();
cvr.startCapturing(EnumPresetTemplate.PT_READ_BARCODES);

We already tried to work around it by deferring open() to the next frame and delaying startCapturing() by 100 ms so open()'s beginConfiguration/commitConfiguration could commit first. This does not reliably prevent the crash on iOS 26 — because open() is fire-and-forget (returns no promise and there is no "camera opened / session running" callback), there is no way from JS to know when configuration has committed before starting.

Expected behavior

CameraEnhancer should serialize beginConfiguration/commitConfiguration against startRunning internally on its capture-session queue so that open() (and any subsequent startCapturing() / torch / setCameraView calls) cannot trigger startRunning while a configuration transaction is still open — particularly under iOS 26's AVFoundation timing.

Questions

  1. Is this a known iOS 26 incompatibility in DynamsoftCameraEnhancer.framework, and is a fix planned?
  2. Is there a newer SDK version with iOS 26 support we should upgrade to?
  3. Is there a supported "camera opened / session started" callback or state we can await before calling startCapturing() / turnOnTorch(), instead of a fixed delay?

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