I have been getting this error message in Swift:
Terminating app due to uncaught exception 'NSUnknownKeyException', reason:
'[<Faceit.ViewController 0x7f8f72501e40> setValue:forUndefinedKey:]:
this class is not key value coding-compliant for the key faceview.'
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var faceView: FaceView! {
didSet{
updateUI()
}
}
var expression = FacialExpression(eyes: .closed, mouth: .frown) {
didSet {
updateUI()
}
}
private func updateUI() {
switch expression.eyes {
case .open:
faceView?.eyesOpen = true
case .closed:
faceView?.eyesOpen = false
case .squinting:
faceView?.eyesOpen = false
}
faceView?.mouthCurvature = mouthCurvatures[expression.mouth] ?? 0.0
}
private let mouthCurvatures = [FacialExpression.Mouth.grin:0.5,.frown: -1.0,.smile:1.0,.neutral:0.0,.smirk:-0.5]
}
faceview
vsfaceView
– vadianfaveview
(withv
) is still worse ;-) Only changing the name is not sufficient. You have to disconnect the dead connection in Interface Builder and connect the proper one. – vadian