AVCapturePhotoSettings Reuse Error
The error message when you reused an AVCapturePhotoSettings object is -[AVCapturePhotoOutput capturePhotoWithSettings:delegate:] Settings may not be re-used'
.
From apple’s documents.
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.
The correct way to do it is to make a new AVCapturePhotoSettings object from copying your pre-made object:
1 | AVCapturePhotoSettings *uniqueSetting = [AVCapturePhotoSettings photoSettingsFromPhotoSettings:self.outputSettings]; |