Open amin-wan-kenobi opened 6 years ago
Hello, I am having the exact same issue. I believe the camera is crashing after about 50 scans or 2 minutes. The app doesn't close but it just locks like it expects the camera to send it data and the camera isn't showing up. Xcode shows no error and everything appears fine. I'm using AVFoundation to do my QR scanning. Is this the same for you and have you found a workaround?
Same issue, have either of you found a work around for it?
I am experiencing the exact same issue than @lavawaters (even the versions are the same). In my case the issue reproduces randomly in the android prod build.
Hello all, I solved my issue my adjusting how my view controllers load. With my issue in the end there wasn't a problem with the camera or even AV Foundation (even though it appeared that way). I solved my issue by changing the way my view controllers loaded. My app was building memory with every scan and after 2 minutes it built to about 30MB and it would crash. I believe Apple will crash the app intentionally if the memory leak is aloud to go too long. So, what I found was I was using "present" for changing view controllers and that I was adding a new view controller copy to the stack every time. When the app would crash, the stack had 50 copies of the same view controller that displayed QR code results. Xcode didn't really show all the copies in the debug report, but it definitely was happening. I switched to "pushing" the same view controller instead of "presenting" it over and over and my memory issue and crashing went away.
Is there any way you could show a code sample for reference?
On Fri, Jan 4, 2019 at 10:27 PM lavawaters notifications@github.com wrote:
Hello all, I solved my issue my adjusting how my view controllers load. With my issue in the end there wasn't a problem with the camera or even AV Foundation (even though it appeared that way). I solved my issue by changing the way my view controllers loaded. My app was building memory with every scan and after 2 minutes it built to about 30MB and it would crash. I believe Apple will crash the app intentionally if the memory leak is aloud to go too long. So, what I found was I was using "present" for changing view controllers and that I was adding a new view controller copy to the stack every time. When the app would crash, the stack had 50 copies of the same view controller that displayed QR code results. Xcode didn't really show all the copies in the debug report, but it definitely was happening. I switched to "pushing" the same view controller instead of "presenting" it over and over and my memory issue and crashing went away.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/moaazsidat/react-native-qrcode-scanner/issues/107#issuecomment-451623830, or mute the thread https://github.com/notifications/unsubscribe-auth/AdZvRwc-O3uqirUlYnUmTa-FF5WIHg8Zks5vABuOgaJpZM4UOeOM .
I get that Android traceback
Fatal Exception: java.lang.RuntimeException: startPreview failed
at android.hardware.Camera.startPreview(Camera.java)
at com.google.android.cameraview.Camera1.startCameraPreview(Camera1.java:194)
at com.google.android.cameraview.Camera1.start(Camera1.java:144)
at com.google.android.cameraview.CameraView.start(CameraView.java:285)
at org.reactnative.camera.RNCameraView.onHostResume(RNCameraView.java:482)
at com.facebook.react.bridge.ReactContext$1.run(ReactContext.java:150)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6653)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:822)
Could it be the same issue? and how to solve
I get that Android traceback
Fatal Exception: java.lang.RuntimeException: startPreview failed at android.hardware.Camera.startPreview(Camera.java) at com.google.android.cameraview.Camera1.startCameraPreview(Camera1.java:194) at com.google.android.cameraview.Camera1.start(Camera1.java:144) at com.google.android.cameraview.CameraView.start(CameraView.java:285) at org.reactnative.camera.RNCameraView.onHostResume(RNCameraView.java:482) at com.facebook.react.bridge.ReactContext$1.run(ReactContext.java:150) at android.os.Handler.handleCallback(Handler.java:790) at android.os.Handler.dispatchMessage(Handler.java:99) at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6653) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:822)
Could it be the same issue? and how to solve
i have the same issue, any thought about it?
In my app, I use QR scanner which is embedded in a component. When I keep opening and closing the component (which has the QR scanner) after several attempts (sometimes up to 50 times somethings 12), the app crashes.
What's happening?
How can it be reproduced?
My phone is connected to the Xcode by cable so I can see all the logs. When it crashes, The error is in Libraries, RNCamera.xcodeproj, RN, RNCamera.m, _setupOrDisableMetadataOutput and it shows the bold line below:
Build details?
ios version: 11.3.1 react-native version: 0.43.4 react-native-camera: 1.0.3 react-native-qrcode-scanner: 1.0.1