Open shtolik opened 4 months ago
So it may not be this camerMode related, still crashes without setting it on ios quite often:(
@shtolik
In PeekabooCamera.ios.kt try change this
dispatch_group_enter(dispatchGroup)
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT.toLong(), 0UL)) {
captureSession.startRunning()
dispatch_group_leave(dispatchGroup)
}
captureSession.commitConfiguration()
dispatch_group_notify(dispatchGroup, dispatch_get_main_queue()) {
onCameraReady()
}
to
captureSession.commitConfiguration()
dispatch_async(queue) {
captureSession.startRunning()
dispatch_async(dispatch_get_main_queue()) {
state.onCameraReady()
}
}
There were crashes on iOS devices when retaking images again and initialCameraMode is passed to rememberPeekabooCameraState.
Not on every image retake, but quite often. I was able to reproduce the problem by adding it into sample code of camera setup in this repo as well.
val state = rememberPeekabooCameraState(initialCameraMode = cameraMode, onCapture = onCapture)
where cameraMode is passed as variable to PeekabooCameraView (i think it wasn't crashing if i just set locally initialCameraMode = CameraMode.Back, but not sure).That's the crash description
And then debug breakpoint is activate in the place below.
So I stopped passing that variable in my app and I think it helped, but need to test on more device - so there is a workaround, but would be great to fix it.