iOS Question B4i LLCamera Error

Discussion in 'iOS Questions' started by Yvon Steinthal, Oct 24, 2017.

  1. Yvon Steinthal

    Yvon Steinthal Active Member Licensed User

    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:

    Code:
    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:

    Code:
    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:

    Code:
    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.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

  3. Yvon Steinthal

    Yvon Steinthal Active Member Licensed User

    I am actually using iMedia 1.21 but i will re-check your example
     
    Last edited: Oct 25, 2017
  4. Erel

    Erel Administrator Staff Member Licensed User

    It is v1.22.
     
  5. Yvon Steinthal

    Yvon Steinthal Active Member Licensed User

    I solved my problem with your example however:

    Code:
    Sub cam_PictureTaken (Data() As Byte)
       
    Dim In As InputStream
       
    In.InitializeFromBytesArray(Data, 0, Data.Length)
       
       
    If(Data.Length>0)Then
         
         
    Dim bmp As Bitmap
         bmp.Initialize2(
    In)
         
    In.Close

         
    Dim out As OutputStream = File.OpenOutput(File.DirDocuments, "eyevudata.png"False)
         bmp.WriteToStream(out,
    100,"PNG")
         out.Close
         
       
    End If
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice