I'm a complete noob at programming it's my first try. I started with the Udemy course from Rob Percival. I'm now at my first app. What it should do:
I enter the age from the dog and when I click "Find Age" it should show me the "real age" from the dog (entered age * 7 )
So ok everything works fine till I get to the point where I want that the final age will show in the app. But I always get the error:
Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<Dog_Years.ViewController 0x7fa05b5baa80> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key dogYears.'
I don't get why. I googled a bit but can't find a solution.
Here is the code:
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var dogRealYears: UILabel!
@IBOutlet weak var age: UILabel!
@IBOutlet weak var textField: UITextField!
@IBAction func findAge(sender: AnyObject) {
var enteredAge = textField.text.toInt()
var dogYears = enteredAge! * 7
dogRealYears.text = "Your dog is \(dogYears)"
}
}