AVCapturePhotoOutput : If you specify a non-nil format dictionary in your settings, your delegate must respond to the selector

Viewed 2207
@IBAction func clickPicture(_ sender: UIButton) {

       let photoSettings = AVCapturePhotoSettings()
        photoSettings.flashMode = .auto
        photoSettings.isHighResolutionPhotoEnabled = true
        if photoSettings.availablePreviewPhotoPixelFormatTypes.count > 0 {
            photoSettings.previewPhotoFormat = [kCVPixelBufferPixelFormatTypeKey as String : photoSettings.availablePreviewPhotoPixelFormatTypes.first!]
        }

        self.wideAngleOutPut.capturePhoto(with: photoSettings, delegate: self)
    }

When i am calling above function to capture image app throwing exception on line: self.wideAngleOutPut.capturePhoto(with: photoSettings, delegate: self)

In log section I can see the error in more details and its like:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* **-[AVCapturePhotoOutput capturePhotoWithSettings:delegate:] If you specify a non-nil format dictionary in your settings, your delegate must respond to the selector****

Can anybody help with this? Thanks in advance.

1 Answers
Related