didFinishProcessingPhoto在for循环中仅执行10次

时间:2018-06-29 11:17:52

标签: ios swift avfoundation

我正在构建一个可捕获许多图像并将其存储在数组中的应用程序,但是我的问题是我的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)

    }
}

0 个答案:

没有答案