Open basuru13 opened 8 years ago
let me check that in detail. Thanks for reporting this issue.
I've run into a similar problem when taking more than one photo in my app. I traced the issue back to the reuse of the self.capturePhotoSettings object that has the same uniqueId.
Here is the Apple Doc reference: https://developer.apple.com/reference/avfoundation/avcapturephotosettings
Important
It is illegal to reuse a AVCapturePhotoSettings instance for multiple captures. Calling the capturePhoto(with:delegate:) method throws an exception (invalidArgumentException) if the settings object’s uniqueID value matches that of any previously used settings object.
To reuse a specific combination of settings, use the init(from:) initializer to create a new, unique AVCapturePhotoSettings instance from an existing photo settings object.
My workaround was to modify the source code as follows.
CameraEngine.swift - line 461
public func capturePhoto(_ blockCompletion: @escaping blockCompletionCapturePhoto) {
let uniqueSettings = AVCapturePhotoSettings.init(from: self.capturePhotoSettings)
self.cameraOutput.capturePhoto(settings: uniqueSettings, blockCompletion)
}
This seems to be working for me now. I hope this is helpful to you guys.
When taking a sequence of photos with the camera example, I get the following error:
-[AVCapturePhotoOutput capturePhotoWithSettings:delegate:] Settings may not be re-used'
Any idea how to create a unique value for the settings?