Skip to content
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

expo-camera work well on Expo Client, but it make crash app when I build ios standalone app #5160

Closed
truyet opened this issue Aug 2, 2019 · 39 comments · Fixed by #5183
Closed

Comments

@truyet
Copy link

truyet commented Aug 2, 2019

🐛 Bug Report

expo-camera work well on Expo Client, but it make crash app when I build ios standalone app

Environment

IOS Standalone App build
Expo CLI 3.0.6 environment info:
System:
OS: macOS 10.14.5
Shell: 5.3 - /bin/zsh
Binaries:
Node: 12.6.0 - /usr/local/bin/node
Yarn: 1.17.3 - /usr/local/bin/yarn
npm: 6.9.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
IDEs:
Android Studio: 3.4 AI-183.5429.30.34.5452501
Xcode: 10.3/10G8 - /usr/bin/xcodebuild
npmPackages:
expo: ^34.0.3 => 34.0.3
react: 16.8.3 => 16.8.3
react-native: https://github.com/expo/react-native/archive/sdk-34.0.0.tar.gz => 0.59.8
react-navigation: ^3.11.1 => 3.11.1
npmGlobalPackages:
expo-cli: 3.0.6

Steps to Reproduce

Ask permission camera on app -> camera permission approved -> Camera tag is render and app crashed on IOS

Expected Behavior

Camera show preview

Actual Behavior

App crashed

@truyet truyet added the bug label Aug 2, 2019
@cruzach
Copy link
Contributor

cruzach commented Aug 2, 2019

Hey @truyet , I just tested this on a blank expo init project with the example code from the docs- and even as a standalone it didn't crash. Could you provide a way for us to repro this?

@cruzach cruzach added Camera needs repro needs more info To be used when awaiting reporter response labels Aug 2, 2019
@sweebee
Copy link

sweebee commented Aug 2, 2019

I saw my app crashing twice (today and yesterday). both when using the camera. Don't know if its related to this issue but i've attached a crash report.

iPhone 7 - iOS 13 - standalone SDK34 (managed)

testflight_feedback.zip

@cruzach
Copy link
Contributor

cruzach commented Aug 2, 2019

iOS 13 is in beta, so it could be related to that. If so, we appreciate you bringing this up. @truyet is this on iOS 13 for you as well?

@truyet
Copy link
Author

truyet commented Aug 3, 2019

@cruzach , I run on IOS 12.4 device

@james075
Copy link

james075 commented Aug 4, 2019

I have the same issue on iOS 12.4 and SDK 34. It crashes every time I open the camera on the standalone app, expo client works well.

@nico26abib
Copy link

nico26abib commented Aug 4, 2019

Same here !
It seen to be some trouble with new sdk version (34)

@EdenGarden
Copy link

Looks like more and more people are running into this. Same there, camera crashes on standalone app but works perfectly on Expo. iOS 12.4. SDK 34.

@ptariche
Copy link

ptariche commented Aug 5, 2019

Crashes on iOS Standalone and Custom iOS Expo client with SDK34. @cruzach @sjchmiela @tsapeta . Perhaps due to deprecating File System for expo-file-system ?

@holgertidemand
Copy link

holgertidemand commented Aug 5, 2019

We are also experience this problem with SDK34 (managed). No problem in the expo client but standalone build crashes on iPhone X ( IOS 12.3.1).

When I open the camera it will prompt for access to the camera, once I give it access it will crash. It will crash right away if I try to start the app again. But if I go to my settings on my phone, remove the access to the camera and try to start the app again, it will work. It will also not crash if I say no to giving the app access to the camera right away. When not giving it access to the camera I can also open my image library, choose a picture from there and proceed. So the issues seems to be directly related to the camera in some way.

Screenshot 2019-08-05 at 12 16 22

@rxhivzero
Copy link

me too sdk34 ios only.

@daveyvanniftrik
Copy link

We are also experiencing the same issue. iOS 12.4, SDK 34.

@sjchmiela
Copy link
Contributor

Hey guys, @sweebee's crash report was helpful and I was able to find a bug in EXBarCodeScanner.m. Turns out in stringValue property of a bar code scanning result can be nil and dictionaries in Objective-C don't accept nils as values.

I have put up a PR which should fix the issue, we'll port it to builders as soon as possible, sorry for the trouble!

If anyone has any more crash reports they would be helpful since we would be able to ensure this is the real cause of all the problems.

@sjchmiela
Copy link
Contributor

Somehow those crash logs are less explicit than @sweebee's (there are no method names), I guess we will have to wait for the deploy to see if that fix worked.

@sweebee
Copy link

sweebee commented Aug 5, 2019

My bug report comes from the expo barcode scanner not from the expo camera. Don't know if your pull request also fixes the issue in the normal camera?

I'm not using the camera for barcodes since it has also a bug on iOS: #5092

@dominic
Copy link

dominic commented Aug 5, 2019

Here's the trace from a crash on a build from ~4 hours ago that I just loaded up through Testflight.

  • iPhone X
  • iOS 13 Developer Beta 5
  • Expo SDK 34
  • expo-camera 6.0.0
0   CoreFoundation                	0x1a4ccadf8 __exceptionPreprocess + 220 (NSException.m:199)
1   libobjc.A.dylib               	0x1a49f40a4 objc_exception_throw + 56 (objc-exception.mm:565)
2   CoreFoundation                	0x1a4bc0b80 +[NSException raise:format:] + 108 (NSException.m:155)
3   ComMyCompany                  	0x102ef08c4 +[FIRVision vision] + 88
4   ComMyCompany                  	0x10211507c +[EXFaceDetector detectorForOptions:] + 56 (EXFaceDetector.m:79)
5   ComMyCompany                  	0x102114990 -[EXFaceDetector initWithOptions:] + 92 (EXFaceDetector.m:19)
6   ComMyCompany                  	0x10211573c -[EXFaceDetectorManager tryEnablingFaceDetection] + 280 (EXFaceDetectorManager.m:133)
7   ComMyCompany                  	0x1020fe368 -[EXCamera maybeStartFaceDetection:] + 344 (EXCamera.m:545)
8   ComMyCompany                  	0x1020fe890 __24-[EXCamera startSession]_block_invoke + 524 (EXCamera.m:610)
9   libdispatch.dylib             	0x1a4998658 _dispatch_call_block_and_release + 24 (init.c:1408)
10  libdispatch.dylib             	0x1a49991cc _dispatch_client_callout + 16 (object.m:495)
11  libdispatch.dylib             	0x1a49767c0 _dispatch_lane_serial_drain$VARIANT$armv81 + 564 (inline_internal.h:2487)
12  libdispatch.dylib             	0x1a49771d8 _dispatch_lane_invoke$VARIANT$armv81 + 400 (queue.c:3820)
13  libdispatch.dylib             	0x1a49804c0 _dispatch_workloop_worker_thread + 576 (queue.c:6380)
14  libsystem_pthread.dylib       	0x1a49e8fa8 _pthread_wqthread + 276 (pthread.c:2304)
15  libsystem_pthread.dylib       	0x1a49ebae4 start_wqthread + 8

Notably: we've only passed onBarCodeScanned to the camera (we're using it as a QR code scanner)

@ptariche
Copy link

ptariche commented Aug 6, 2019

Anyone find a work around in the meanwhile?

@sjchmiela
Copy link
Contributor

Thank you, @dominic, for providing the stack trace, it has been really helpful! We will fix the problem as soon as possible. 🙂

@asttel
Copy link

asttel commented Aug 6, 2019

We have the same issue with camera crashing with SDK34, but we don't use expo-face-detector nor expo-barcode-scanner. I'm only able to get the crash report from my device without the method names. @dominic @sweebee How did you get the trace/crash report with method names?

sjchmiela added a commit that referenced this issue Aug 6, 2019
…5183)

# Why

Should fix #5160.

# How

I inspected crash log (#5160 (comment)) and found that it points to this line to this error. Now the code will ensure that the value it wants to send to JS is not nil.

# Test Plan

I haven't executed any tests, Expo client compiled.
sjchmiela added a commit that referenced this issue Aug 6, 2019
#5194)

# Why

Potential fix for #5160.

# How

Latest obtained [crash stack trace](#5160 (comment)) suggests it's actually the Firebase what is crashing. This could happen either because we don't include proper `GoogleService-Info.plist` inside shell app or due to some other problem. This should prevent crashing when initializing face detector fails.

# Test Plan

I looked at previous revision of `EXFaceDetectorManager.m` and creating face detector was happening inside `try-catch`:

https://github.com/expo/expo/blob/1da2f1891ab578f1f442a5ec069186f2f085cd12/packages/expo-face-detector/ios/EXFaceDetector/EXFaceDetectorManager.m#L103-L109
sjchmiela added a commit that referenced this issue Aug 6, 2019
…5183)

# Why

Should fix #5160.

# How

I inspected crash log (#5160 (comment)) and found that it points to this line to this error. Now the code will ensure that the value it wants to send to JS is not nil.

# Test Plan

I haven't executed any tests, Expo client compiled.
sjchmiela added a commit that referenced this issue Aug 6, 2019
#5194)

# Why

Potential fix for #5160.

# How

Latest obtained [crash stack trace](#5160 (comment)) suggests it's actually the Firebase what is crashing. This could happen either because we don't include proper `GoogleService-Info.plist` inside shell app or due to some other problem. This should prevent crashing when initializing face detector fails.

# Test Plan

I looked at previous revision of `EXFaceDetectorManager.m` and creating face detector was happening inside `try-catch`:

https://github.com/expo/expo/blob/1da2f1891ab578f1f442a5ec069186f2f085cd12/packages/expo-face-detector/ios/EXFaceDetector/EXFaceDetectorManager.m#L103-L109
@cruzach cruzach removed the needs more info To be used when awaiting reporter response label Aug 6, 2019
@dominic
Copy link

dominic commented Aug 6, 2019

@sjchmiela Will this change be picked up if I build a new version of my app via Expo's servers, or do we need to wait for the release of a new version of expo-camera (or a related dependency)?

@dominic
Copy link

dominic commented Aug 6, 2019

@asttel re: symbols, I pulled this off a Testflight app on a device I'd set up for development via Xcode. It looks like all Testflight/App Store reported crashes should be symbolicated correctly per Apple's technical note (and you can re-symbolicate one manually via those instructions as well, though it looks a little complicated).

@raphaelrk
Copy link
Contributor

raphaelrk commented Aug 6, 2019

Seems to still crash for me on a TestFlight build from ~an hour ago. Not sure how to get crash logs (I think you need iOS 13 for that). Could it still be happening because I didn't reinstall my node modules before building? Seems like I also built on expo-cli 3.0.8, while the latest is 3.0.9. Going to update and try again.

Update: still crashing on new testflight build after updating expo-cli (3.0.9), expo (34.0.4) and expo-camera (6.0.0)

@sjchmiela
Copy link
Contributor

I will let you know when the fix is deployed. Once it is, you will need to rebuild your iOS app (expo build:ios). 🙂

@sjchmiela
Copy link
Contributor

The issue should be fixed now. Try rebuilding your apps with expo build:ios! 🎉

@ptariche
Copy link

ptariche commented Aug 8, 2019

@sjchmiela looks to still be occurring with the expo custom client build

@sjchmiela
Copy link
Contributor

Yeah, Expo custom client builds are yet to be fixed, on it!

@borgogelli
Copy link

I use turtle-cli to build the ios app, does it should work now with expo 34.0.4 ? Or should I wait an expo update ?

@sjchmiela
Copy link
Contributor

You will need to use just-published turtle-cli@0.11.1 to get the update. This is the only change required if you're using Turtle to build your standalone apps.

@sjchmiela
Copy link
Contributor

Custom Expo clients built from now on should include that fix. 🙂

@ptariche
Copy link

ptariche commented Aug 9, 2019

Cheers!

@changjingli
Copy link

I have the same issue on Android. The log is below.

  • MI 5 API 28
  • Expo SDK 34.0.4
  • expo-camera 6.0.0
import { Camera } from 'expo-camera';

<Camera
    style={styles.camera}
    onBarCodeScanned={this.handleBarCodeScanned}
    flashMode={torch}
    ref={(cam) => {
        this.camera = cam;
    }}
></Camera>

[android.log](https://github.com/expo/expo/files/3490910/android.log)

@He1nr1chK
Copy link

He1nr1chK commented Aug 16, 2019

I also still have to same issue running

  • iOS 12.1
  • Expo SDK 34.0.4
  • expo-camera 6.0.0
  • expo-face-detector 6.0.0
import * as FaceDetector from "expo-face-detector";
import { Camera } from "expo-camera";

<Camera
  style={{ flex: 1, alignItems: "center" }}
  type={this.props.cameraType}
  onFacesDetected={this.handleFacesDetected}
  faceDetectorSettings={{
     mode: FaceDetector.Constants.Mode.fast,
     detectLandmarks: FaceDetector.Constants.Mode.none,
     runClassifications: FaceDetector.Constants.Mode.none
   }}
  onFaceDetectionError={this.handleFaceDetectionError}
  ref={ref => {
      this.camera = ref;
  }}
/>

@wodin
Copy link
Contributor

wodin commented Aug 17, 2019

I have the same issue on Android.

Hi @changjingli. Since your crash happens on Android, maybe it would be best to create a new issue.

@He1nr1chK
Copy link

Hi @sjchmiela sorry for the last response but it still is not working with FaceDetector.

Last Exception Backtrace:
0 CoreFoundation 0x1bedcbea0 __exceptionPreprocess + 228
1 libobjc.A.dylib 0x1bdf9da40 objc_exception_throw + 55
2 CoreFoundation 0x1becd2674 +[NSException raise:format:] + 115
3 my app 0x1015622f8 +[FIRVision vision] + 87
4 my app 0x100413758 +[EXFaceDetector detectorForOptions:] + 1374040 (EXFaceDetector.m:79)
5 my app 0x100412c8c -[EXFaceDetector initWithOptions:] + 1371276 (EXFaceDetector.m:19)
6 my app 0x100414284 -[EXFaceDetectorManager tryEnablingFaceDetection] + 1376900 (EXFaceDetectorManager.m:133)
7 my app 0x100414090 -[EXFaceDetectorManager maybeStartFaceDetectionOnSession:withPreviewLayer:mirrored:] + 1376400 (EXFaceDetectorManager.m:117)
8 my app 0x100405d70 -[EXCamera maybeStartFaceDetection:] + 1318256 (EXCamera.m:545)
9 my app 0x100406540 __24-[EXCamera startSession]_block_invoke + 1320256 (EXCamera.m:610)
10 libdispatch.dylib 0x10458b824 0x104588000 + 14372
11 libdispatch.dylib 0x10458cdc8 0x104588000 + 19912
12 libdispatch.dylib 0x104594e6c 0x104588000 + 52844
13 libdispatch.dylib 0x104595b60 0x104588000 + 56160
14 libdispatch.dylib 0x10459fbfc 0x104588000 + 97276
15 libsystem_pthread.dylib 0x1be9e80dc _pthread_wqthread + 311
16 libsystem_pthread.dylib 0x1be9eacec start_wqthread + 3

@sjchmiela
Copy link
Contributor

Hey, @He1nr1chK! When was the last time you have rebuilt your native app? (expo build:ios?) To get latest fixes you will need to rebuild the app. Maybe your app is ejected?

@He1nr1chK
Copy link

My mistake, yes my app is ejected. Don't know how I missed that detail on the tread. Any active issues on the topic? @sjchmiela

@sjchmiela
Copy link
Contributor

Try upgrading to expo-face-detector@6.0.1! 🙂

@He1nr1chK
Copy link

Thank you!

@lock lock bot added the outdated label Feb 17, 2020
@lock lock bot locked and limited conversation to collaborators Feb 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.