imaginary-cloud / CameraManager

Simple Swift class to provide all the configurations you need to create custom camera view in your app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

does not work on iPhone 15 Pro Max

thierrybucco opened this issue · comments

CameraManager does not work anymore on my device: iPhone 15 Pro Max.
It fails in stillImageOutput.captureStillImageAsynchronously.
here is the error (which seems to be generic, without more informations)

▿ CaptureResult

  • failure : Error Domain=AVFoundationErrorDomain Code=-11819 "Cannot perform action" UserInfo={NSLocalizedDescription=Cannot perform action, NSUnderlyingError=0x2828c0480 {Error Domain=NSOSStatusErrorDomain Code=-16405 "(null)"}, NSLocalizedRecoverySuggestion=Try again later., NSLocalizedFailureReason=XXXXDEFAULTVALUEXXXX}
sessionQueue.async { [weak self] in
            if let self = self {
                let stillImageOutput = self._getStillImageOutput()
                if let connection = stillImageOutput.connection(with: AVMediaType.video),
                   connection.isEnabled {
                    if self.cameraDevice == CameraDevice.front, connection.isVideoMirroringSupported,
                       self.shouldFlipFrontCameraImage {
                        connection.isVideoMirrored = true
                    }
                    if connection.isVideoOrientationSupported {
                        connection.videoOrientation = self._currentCaptureVideoOrientation()
                    }
                    
                    stillImageOutput.captureStillImageAsynchronously(from: connection, completionHandler: { [weak self] sample, error in
                        
                        if let error = error {
<<< failed here!
                            self?._show(NSLocalizedString("Error", comment: ""), message: error.localizedDescription)
                            imageCompletion(.failure(error))
                            return
                        }
                        
                        guard let sample = sample else { imageCompletion(.failure(CaptureError.noSampleBuffer)); return }
                        if let imageData = AVCaptureStillImageOutput.jpegStillImageNSDataRepresentation(sample) {
                            imageCompletion(CaptureResult(imageData))
                        } else {
                            imageCompletion(.failure(CaptureError.noImageData))
                        }
                        
                    })
                } else {
                    imageCompletion(.failure(CaptureError.noVideoConnection))
                }
            }
        }

Do you have an idea?
Thanks

Same here, it works on 15 max only after zooming in - I guess it's after a camera switch