1
votes

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
-12686 indicates that there was a buffer allocation failure near the beginning of the camera pipeline. -16802 is similarly an indication of still image failure at the driver layer. - Gizmodo
Those seem to be very helpful from that thread. - Gizmodo

1 Answers

2
votes

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.