Hi,
I am trying to get rid of a crash related error that comes from triggering a cam.TakePicture before the camera has even started.
Here's what i do:
Once that is initialized, the trigger to take a picture is on the pnlCamPhoto_Click event as follows:
The problem i have is when the user clicks the panel too fast!
The following error is logged:
How can i either stop the error from crashing the app, or actually blocking user click event before the actual preview and camera is ready to take a photo?
Thanks.
Y.
I am trying to get rid of a crash related error that comes from triggering a cam.TakePicture before the camera has even started.
Here's what i do:
B4X:
cam.Initialize(pnlCamPhoto,"cam",False)
cam.PreserveRatio = True
cam.Preset = cam.PRESET_1920x1080
cam.BeginConfiguration
cam.Zoom = 1
cam.CommitConfiguration
cam.resize
cam.StartPreview
Once that is initialized, the trigger to take a picture is on the pnlCamPhoto_Click event as follows:
B4X:
Sub cam_photo_click
cam.TakePicture
pnlCamPhoto.RemoveViewFromParent
End Sub
The problem i have is when the user clicks the panel too fast!
The following error is logged:
B4X:
error taking picture: Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo={NSLocalizedFailureReason=An unknown error occurred (-16800), NSLocalizedDescription=The operation could not be completed, NSUnderlyingError=0x1c44492a0 {Error Domain=NSOSStatusErrorDomain Code=-16800 "(null)"}}
Error occurred on line: 1206 (Main)
*** +[AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:] NULL sample buffer.
Stack Trace: (
CoreFoundation <redacted> + 148
libobjc.A.dylib objc_exception_throw + 56
AVFoundation <redacted> + 0
EyeVu __26-[B4ILLCamera TakePicture]_block_invoke + 116
AVFoundation <redacted> + 1756
CoreFoundation <redacted> + 20
CoreFoundation <redacted> + 288
CoreFoundation <redacted> + 2436
CoreFoundation CFRunLoopRunSpecific + 436
GraphicsServices GSEventRunModal + 100
UIKit UIApplicationMain + 208
EyeVu main + 124
libdyld.dylib <redacted> + 4
)
SignalHandler 6
How can i either stop the error from crashing the app, or actually blocking user click event before the actual preview and camera is ready to take a photo?
Thanks.
Y.