Установка делегата для UIImagePicker возвращает ошибку
Возникла проблема в каком-то быстром коде, который я написал для приложения для перевода OCR. Фрагмент кода ниже:
@IBAction func btnOCR(sender: AnyObject) {
var languageAlert = UIAlertController(title: "For Your Information...", message: "The OCR feature currently only supports English & French.", preferredStyle: .Alert)
languageAlert.addAction(UIAlertAction(title: "Okay", style: .Default, handler: { action in
var image = UIImagePickerController()
image.sourceType = UIImagePickerControllerSourceType.Camera
image.allowsEditing = false
image.delegate = self
presentViewController(image, animated: true, completion: nil)
}))
self.presentViewController(languageAlert, animated: true, completion: nil)
}
Строка image.delegate = self возвращает ошибку: невозможно присвоить значение типа viewcontroller для uiimagepickerdelegate.
Я установил делегат в определении класса, это можно увидеть ниже ...
class ViewController: UIViewController, UITextFieldDelegate, UIPickerViewDelegate, UIPickerViewDataSource, UIImagePickerControllerDelegate { }
Все и любая помощь будет оценена, спасибо заранее.