AVCapturePhotoCaptureDelegate Error When Capturing Image

858 views Asked by At

I seem to get this error message randomly after a few cycles of capture:

Error finishing photo: Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo={NSLocalizedFailureReason=An unknown error occurred (-16802), NSLocalizedDescription=The operation could not be completed, NSUnderlyingError=0x281f20f30 {Error Domain=NSOSStatusErrorDomain Code=-16802 "(null)"}}

Error occurs in:

func photoOutput(_ output: AVCapturePhotoOutput, didFinishProcessingPhoto photo: AVCapturePhoto, error: Error?) {}

Notes:

  • This Error never comes up on the first capture.
  • The image format is also a processed format: HEIF
  • iOS 13
1

There are 1 answers

3
Shashwat KN On

Had the same issue, the culprit was stabilization. I was setting settings.isAutoStillImageStabilizationEnabled = true while capturing the image. Stabilization is a heavy process which on main thread which hinders the buffer allocation. Moved it to where camera was getting initialized, resolved the issue for me.