Since I am using Swift 3, the following error appears.
Cannot set value to type '(LLSimpleCamera ?, NSError?) → Void' to type '((LLSimpleCamera ?, Error?) → Void)!
Does anyone know what to do? here is my code ..
camera.onError = { (camera: LLSimpleCamera?, error: NSError?) -> Void in
print("Camera error: \(error)")
if error.domain == LLSimpleCameraErrorDomain {
if error.code == Int(LLSimpleCameraErrorCodeCameraPermission.rawValue) || error.code == Int(LLSimpleCameraErrorCodeMicrophonePermission.rawValue) {
let alertVC = UIAlertController(title: "Ooops!", message: "We need permission for the camera. Please go to your settings.", preferredStyle: .alert)
let okAction = UIAlertAction(title: "OK", style: .default, handler: nil)
let settingsAction = UIAlertAction(title: "Settings", style: .default) { (action) in
UIApplication.shared.openURL(URL(string: UIApplicationOpenSettingsURLString)!)
}
alertVC.addAction(okAction)
alertVC.addAction(settingsAction)
self.present(alertVC, animated: true, completion: nil)
}
}
}
source
share