question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Expo crash after <Camera> mounts (sometimes) [iOS]

See original GitHub issue

🐛 Bug Report

Environment

Diagnostics:

  Expo CLI 2.11.6 environment info:
    System:
      OS: macOS 10.14.3
      Shell: 5.3 - /bin/zsh
    Binaries:
      Node: 8.15.0 - /usr/local/opt/node@8/bin/node
      Yarn: 1.13.0 - /usr/local/bin/yarn
      npm: 6.4.1 - /usr/local/opt/node@8/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    IDEs:
      Xcode: 10.2/10E125 - /usr/bin/xcodebuild
    npmPackages:
      @storybook/react-native: ^4.1.7 => 4.1.11
      expo: ^32.0.6 => 32.0.6
      react: 16.5.0 => 16.5.0
      react-native: https://github.com/expo/react-native/archive/sdk-32.0.2.tar.gz => 0.57.1
      react-navigation: ^3.5.1 => 3.5.1

App target: iOS app for iPad, not ejected. Issue reproducible with the IPA file and with the Expo client, as well as in the simulator.

I have local stacktraces generated from my actual application, let me know if you need them.

Steps to Reproduce

I have an app using react-navigation and the Camera component. When opening the app and pressing a button, we navigate to a second screen with more or less the Camera example from the docs. It works fine - I am scanning a QR code. When going back (camera screen unmounts) and on this screen again a couple times, the app will crash entirely (Expo closes). This sometimes happen on the first mount as well.

The error message is the following:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[AVCaptureSession addOutput:] Cannot add output <AVCaptureMetadataOutput: 0x28225f6c0> to capture session <AVCaptureSession: 0x2820f40c0 [AVCaptureSessionPresetHigh]> because more than one output of the same type is unsupported'

Expected Behavior

The app never crashes 😉

Actual Behavior

Random crash when trying to actually mount the <Camera> element.

Reproducible Demo

I was able to reproduce the issue on a fresh base: https://github.com/MickaelBergem/bug-repro-camera-crash. I usually need to repeat the unmount/mount cycle by navigating back and forth at least 10 times before the app crashes.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

9reactions
NathanBeesleycommented, Apr 5, 2019

I have been trying to figure out a similar bug for a while. Expo/App Store app was crashing with no stack trace. I was experiencing this on iOS 12.1+. I was passing barCodeScannerSettings something like { barCodeTypes: [BarCodeScanner.Constants.BarCodeType.code39, BarCodeScanner.Constants.BarCodeType.code39mod43] }}. I even tried { barCodeTypes: [] }}. I still experienced the crash. I found to resolve my issue was to remove prop barCodeScannerSettings altogether. Haven’t experienced it again. Hope this helps!

1reaction
MickaelBergemcommented, Apr 5, 2019

@NathanBeesley you just saved my day!! Thanks a lot.

I just tested it on the reproduction case, and it’s no longer crashing. I confirm this workaround works.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Expo Camera not mounting properly - Expo SDK - Forums
So I decided to make a simple camera page based on the full example ... this scene) the app will freeze like shown...
Read more >
Expo built app crash on Testflight | Apple Developer Forums
This means that your app crashed itself by calling abort . The presence of the Last Exception Backtrace section indicates that this is...
Read more >
Expo camera taking picture crashing application
I'm currently using the expo camera in my application on iOS. The app crashes when I try to save the image like this....
Read more >
DDPai Dash Cam, with Wi-Fi 1080p Dash Camera ...
Buy DDPai Dash Cam, with Wi-Fi 1080p Dash Camera, Emergency Accident Lock, 140 Wide Angle, Car DVR Dashboard Camera with G-Sensor, WDR, Built-in...
Read more >
Clemson Vehicular Electronics Laboratory: Accident Recorders
Accident recorders are systems that constantly record information related to the ... accident recorders are after-market systems usually mounted just behind ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found