我正在构建一个可捕获许多图像并将其存储在数组中的应用程序,但是我的问题是我的didFinishProcessingPhoto
仅执行10次,而我的for循环为20。
我的代码:-
func photoOutput(_ output: AVCapturePhotoOutput, didFinishProcessingPhoto photo: AVCapturePhoto, error: Error?) {
guard let data = photo.fileDataRepresentation(),
let image = UIImage(data: data) else {
return
}
self.img.image = image
self.imgs.append(image)
}
@IBAction func cameraButton_TouchUpInside(_ sender: Any) {
for i in 0 ... 20 {
let settings = AVCapturePhotoSettings()
self.photoOutput?.capturePhoto(with: settings, delegate: self)
}
}