So I am working through a tutorial and I have made sure that I followed the author to the letter and my code throws the following error.
2014-10-01 22:26:14.545 stopwatch2[3503:861733] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<stopwatch2.ViewController 0x7c57f050> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key pause.'
My Question is:
Based on the error provided what is the reason my application is failing ?
Here's my code that won't compile:
import UIKit
class ViewController: UIViewController {
var timer = NSTimer()
@IBOutlet var time : UILabel!
var count = 0
@IBAction func play(sender : AnyObject) {
timer = NSTimer.scheduledTimerWithTimeInterval(1, target: self, selector: Selector("result"), userInfo: nil, repeats: true)
}
@IBAction func pause(sender : AnyObject) {
timer.invalidate()
}
@IBAction func reset(sender : AnyObject) {
timer.invalidate()
count = 0
time.text="0"
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
func result() {
count++
time.text = String(count)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
What I would really like to know, is how to investigate this on my own because I am sure the authors other videos will yield the same results.
The videos are from udemy.com, The Complete iOS8 and Swift Course..
Thanks in advance for any help.