Thank you for replying my question.
I will show you the 'func photoOutput' code and exception below.
func photoOutput(_ output: AVCapturePhotoOutput,didFinishProcessingPhoto photo: AVCapturePhoto, error: Error?) {
let photoData = photo.fileDataRepresentation()
let imagePhoto = UIImage(data: photoData!)
UIImageWriteToSavedPhotosAlbum(imagePhoto!, self, nil, nil)
let pixelBuffer:CVPixelBuffer = (photo.depthData?.depthDataMap)! // --> At second callback, exception occurs. The message is "Thread 1: EXC_BREAKPOINT (code=1, subcode=0x102dfe2d0)"
let metadataAttachments: CFDictionary = photo.metadata as CFDictionary
guard let jpegData = ViewController.jpegData(withPixelBuffer: pixelBuffer, attachments: metadataAttachments) else{
print("Unable to create JPEG photo")
return
}
let depthPhoto=UIImage(data:jpegData)
UIImageWriteToSavedPhotosAlbum(depthPhoto!, self, nil, nil)
}