-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
App crashing randomly while taking images by camera in iOS14 #678
Comments
hey at all - any news/workarounds for that? |
Can you please re-test v5.0.1? |
We are having the same app crashing issue on the 40th - 50th photo with the below environment and have the same crash issue whether on both Camera plugin 4.1.0 and 5.0.1. The app has always crashed on about the 250th - 350th photo on older iOS versions, but crashing on 40th - 50th photo makes it difficult for a user. Has there possibly been any progress here? Camera plugin 4.1.0 and 5.0.1 |
So far from what I can dig up, Is that it might be related to an older bug with Capacitor regarding removing event listeners while events are still being triggered. ionic-team/capacitor#1943 |
The same error appears in an Ionic app built with capacitor and an input type=file in the webview when you select the camera option:
This app does not crash tho and I get a File object in the FileList of the html file input element. So this looks more like an iOS bug? |
I think we may have found a potential fix using a slightly different implementation, however we would need an option added to the plugin to be able to start the camera and leave it started in the background, instead of stopping the camera at the end of each use. We found this potential fix while testing a different camera plugin (cordova-plugin-camera-preview) that has an option to either start and stop the plugin after each use or to start and leave it started in the background. When using this plugin with the start and stop (after each photo capture) option on iOS 14, the app crashes after about 40 photos. When using the option to leave the camera started in the background, we got to 1,000 photos with no crash. We plan to leave the camera plugin open during each photo shoot of a single object, so the user can take their 30 - 50 photos of the object and then close the camera at the end of the shoot. We ran the same test on Android 10 and 11 and believe it may also fix issue #665. Is it possible for cordova-plugin-camera to have a similar option to leave the camera started in the background? Thank you in advance for your consideration. |
Checking in to see if there is a possibility someone might have time soon to look into this issue. It is reproducible every time on iOS 14.1 - 14.4. App is consistently crashing on the 40th - 50th photo. Thanks for your consideration. |
@ita33 can you elaborate on your current setup? did you switch to Cordova-plugin-camera-preview? |
Hi, we're facing the same problem. is there a fix we could apply waiting for the real fix from the plugin? Is there at least a way of catching the error so we can show a message to the user? |
Hi, has any changes? |
I took the same approach as @ita33 and it works well, run Then do something along the lines of the following, where element is the dom element you want to contain the photo preview. var targetPosition = element.getBoundingClientRect();
CameraPreview.startCamera({
x: targetPosition.left,
y: targetPosition.top,
width: targetPosition.width,
height: targetPosition.height,
//...other options
}); Then wire up your buttons to take a photo etc. Also don't forget to listen to orientation change event so your camera repositions with your dom element window.removeEventListener('orientationchange', repositionCamera); |
stale |
Bug Report
Problem
After taking the picture app crashing randomly in iOS 14. Sometimes it allows to take picture more than 40-50 but sometimes it get crash after taking 4-5 images.
What is expected to happen?
Crash should not happen.
What does actually happen?
While taking picture app is crashing randomly.
Log:
2020-10-15 16:58:38.407845+0530 MyApp[1853:107942] [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-10-15 16:58:41.897670+0530 MyApp[1853:107942] [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-10-15 16:58:44.499771+0530 MyApp[1853:107942] [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-10-15 16:58:48.525883+0530 MyApp[1853:107942] [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-10-15 16:58:50.795885+0530 MyApp[1853:111849] *** Terminating app due to uncaught exception 'NSGenericException', reason: '*** Collection <__NSArrayM: 0x281798900> was mutated while being enumerated.'
*** First throw call stack:
(0x1860a25ac 0x19a11c42c 0x1860a1f04 0x1ae8faa28 0x1ae8fad60 0x1ae9adae4 0x1cd588794 0x102ca20f8 0x102ca0f50 0x102c90dd4 0x102c91cb4 0x102c9de38 0x1cd5f4908 0x1cd5fb77c)
libc++abi.dylib: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSGenericException', reason: '*** Collection <__NSArrayM: 0x281798900> was mutated while being enumerated.'
terminating with uncaught exception of type NSException
2020-10-15 17:06:47.634387+0530 MyApp[1853:109314] [Camera] [CAMCaptureEngine] Received a session runtime error notification : Error Domain=AVFoundationErrorDomain Code=-11819 "Cannot Complete Action" UserInfo={NSLocalizedDescription=Cannot Complete Action, NSLocalizedRecoverySuggestion=Try again later.}
2020-10-15 17:06:47.634549+0530 MyApp[1853:109314] [Camera] [CAMCaptureEngine] Performing recovery from error: Error Domain=AVFoundationErrorDomain Code=-11819 "Cannot Complete Action" UserInfo={NSLocalizedDescription=Cannot Complete Action, NSLocalizedRecoverySuggestion=Try again later.}
2020-10-15 17:06:47.634730+0530 MyApp[1853:109314] [Camera] [CAMCaptureEngine] Attempting to recover from a session runtime error by restarting the AVCaptureSession...
*** Terminating app due to uncaught exception 'NSGenericException', reason: '*** Collection <__NSArrayM: 0x281798900> was mutated while being enumerated.'
terminating with uncaught exception of type NSException
Information
Since this issue is random , So try taking lot of images continuously approx 50 to 60. Sometimes app crash only with 4-5 images. This issue I am facing only with iOS 14 or iOS14.0.1.
Environment, Platform, Device
iPhone XR
iOS. 14.0
Xcode 12.0
Camera plugin 5.0.0
Cordova iOS 5.1.1
I have added sample app and crash log.
Camera-Plugin-Demo.zip
The text was updated successfully, but these errors were encountered: