Swift初心者です。
初投稿ですので、上手い投稿方法が解らないですがよろしくお願いします!
問題点は、写真を撮るためのfuncを作成しているのですが、Swift3での記述の仕方がわかりません。。。
// AVCaptureStillImageOutput! → AVCapturePhotoOutput!にSwift3で変更
var stillImageOutput: AVCapturePhotoOutput!
func didTakePhoto() {
if let videoConnection = stillImageOutput.connection(withMediaType: AVMediaTypeVideo) {
videoConnection.videoOrientation = AVCaptureVideoOrientation.portrait
stillImageOutput?.captureStillImageAsynchronouslyFromConnection(videoConnection, completionHandler: { (buffer, error) in
if error == nil && buffer != nil {
let imageData = AVCaptureStillImageOutput.jpegStillImageNSDataRepresentation(buffer)
let image = UIImage(data: imageData)
self.imageView.image = image
self.isShowingPhoto = true
self.captureSession.stopRunning()
}
})
}
}
ここのcaptureStillImageAsynchronouslyFromConnectionが
/*
『Value of type 'AVCapturePhotoOutput' has no member'captureStillImageAsynchronouslyFromConnection'』
*/
とエラーになりまして、調べているとSwift3ではAVCapturePhotoOutputのメソッドにはないと言うことが理解できました。
改変の記述方法はどのようにすれば良いでしょうか??