0

app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key button_1.'

class ViewController: UIViewController {

@IBAction func button1_pressed(sender: AnyObject) {
    NSLog("hello");
}

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

}

hunterp
  • 15,716
  • 18
  • 63
  • 115
  • possible duplicate of [This class is not key value coding-compliant for the key](http://stackoverflow.com/questions/3088059/this-class-is-not-key-value-coding-compliant-for-the-key) – jtbandes Aug 01 '15 at 22:01

2 Answers2

1

It seems that you have no outlet defined (anymore). The storyboard still thinks there is an @IBOutlet weak var button_1: UIButton? but you have deleted it apparently.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
0

Check storyboard or xib (whichever you're using). The most likely source of this error is that something has a connection to an action or outlet that doesn't exist in the code.

Uttam Sinha
  • 722
  • 6
  • 9