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

bug: [iOS] Capacitor Camera API crashes the app when it should open the camera to take a photo (iphone11 | ios14.2) #3865

Closed
marcelo-ansaldi-baltazar opened this issue Nov 25, 2020 · 8 comments

Comments

@marcelo-ansaldi-baltazar

Bug Report

Capacitor Version

Latest Dependencies:

  @capacitor/cli: 2.4.2     

  @capacitor/core: 2.4.2    

  @capacitor/android: 2.4.2 

  @capacitor/electron: 2.4.2

  @capacitor/ios: 2.4.2

Installed Dependencies:

  @capacitor/electron not installed

  @capacitor/cli 2.2.0

  @capacitor/core 2.2.0

  @capacitor/android 2.2.0

  @capacitor/ios 2.2.0

[error] "laboratorio" is missing in "E:\Proyectos\app-laboratorio-clinico-etcheverry\android\app\src\main\java". Please create a directory structure matching the package id "laboratorio.etcheverry.ripit.cl" within the directory "E:\Proyectos\app-laboratorio-clinico-etcheverry\android\app\src\main\java".

Platform(s)

iOS

Current Behavior

Ionic 4 + Angular 9 + Capacitor.

I implemented the Capacitor Camera API function getPhoto() like this:

image
image

This works perfect in android and chrome (using ionic serve).

But in iOS, when i run my app in an xcode simuator, the following happens:

For the camera option (CameraSource.Camera), the app in the device crashes and throws the following error in the xcode terminal:

APP INACTIVE
2020-11-23 22:50:14.617158-0300 etcheverry[10753:1172222] [Camera] Failed to read exposureBiasesByMode dictionary: Error Domain=NSCocoaErrorDomain Code=4864 " -[NSKeyedUnarchiver _initForReadingFromData:error:throwLegacyExceptions:]: data is NULL" UserInfo={NSDebugDescription= -[NSKeyedUnarchiver _initForReadingFromData:error:throwLegacyExceptions:]: data is NULL}
2020-11-23 22:50:14.643779-0300 etcheverry[10753:1172222] Metal API Validation Enabled
2020-11-23 22:50:14.793533-0300 etcheverry[10753:1173016] fopen failed for data file: errno = 2 (No such file or directory)
2020-11-23 22:50:14.793605-0300 etcheverry[10753:1173016] Errors found! Invalidating cache...
2020-11-23 22:50:14.831713-0300 etcheverry[10753:1173016] fopen failed for data file: errno = 2 (No such file or directory)
2020-11-23 22:50:14.831761-0300 etcheverry[10753:1173016] Errors found! Invalidating cache...
APP ACTIVE
2020-11-23 22:50:15.452421-0300 etcheverry[10753:1172222] Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '¿¿
First throw call stack:
(0x1ae17c878 0x1c26d2c50 0x1b041927c 0x1b0419ce4 0x1b0434740 0x1b0430d00 0x1b04309dc 0x1b1033c3c 0x1b10338e8 0x1b106b7b8 0x1b103db1c 0x1b103e084 0x1b103e1e8 0x1b15a3160 0x1026a96c0 0x1026b8f34 0x1ae0f811c 0x1ae0f2120 0x1ae0f121c 0x1c5170784 0x1b0b2a200 0x1b0b2fa74 0x1020b76ec 0x1addb16c0)
libc++abi.dylib: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present modally a view controller <UIImagePickerController: 0x106009c00> that is already being presented by <Capacitor.CAPBridgeViewController: 0x102a095a0>.'
terminating with uncaught exception of type NSException
(lldb)

Expected Behavior

The camera opens when the (CameraSource.Photos), option is selected. (meaning it doesn't crash)

Code Reproduction

https://github.com/marcelo-ansaldi-baltazar/issueCapacitatorCameraApi

I followed these steps:

-Tap on “Cotizar examen”
-Tap on “Adjuntar”
-Accept camera request
-App crashes

Other Technical Details

npm --version output: 6.13.8

node --version output: 12.19.0

pod --version output (iOS issues only): 1.10.0

Additional Context

Forgot to mention that the Capacitor documentation includes this:

image

But i think i have the right thing by default (meaning didn't change anything myself)
image

@Th3lios
Copy link

Th3lios commented Dec 3, 2020

nice

@jayordway
Copy link

Why was this closed?

@jfbloom22
Copy link

I believe I am running into the same issue.

@brumscotto
Copy link

Having the same issue here. Anyone find a fix?

@tomchiverton
Copy link

I think I have this issue. @marcelo-ansaldi-baltazar how did you fix this ?

@jcesarmobile
Copy link
Member

this was fixed here #5282
released the fix in capacitor 3.3.3

@tomchiverton
Copy link

In my case, it seemed to have been missing one of the three entries in the .plist that triggered the error

@ionitron-bot
Copy link

ionitron-bot bot commented Nov 10, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Nov 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants