title: Why do I have errors when I try to change view controllers
body: <p><strong>Not sure how to close this question, but a comment resolved my problem</strong></p>
  
  <p>When I try to change view controllers in my code I get this error</p>
  
  <p>@RMaddy No, this is not a duplicate, My error is due to defaults, but the error is taking place in a transition of view controllers. So before you rush to conclusions, please read the question.</p>
  
  <p>(Further Clarification) No, the class I am trying to instantiate from the storyboard does have the correct class (id) and the correct identifier, so that is not the problem</p>
  
  <pre><code>2016-02-24 10:04:25.271 Shapes Game[3834:27900] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[&lt;Shapes_Game.ScoreViewController 0x7ff263e87150&gt; setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key highScore.'
  *** First throw call stack:
  (
  </code></pre>
  
  <p>My code worked fine before I added this to my code (All the NSUserDefaults and updating the high score)</p>
  
  <p>I'm not sure why my code is causing an error, but any help would be appreciated.</p>
  
  <p>I Apologize in advance if my code is too difficult to read. If you need clarification on what I need help in, just comments below. (I just want to know what I can do to fix this)</p>
  
  <pre><code>func updateHighScore() {
      let score: Int? = NSUserDefaults.standardUserDefaults().valueForKey("highScore") as? Int
      if let highScore = score {
          if highScore &lt; totalScore {
              highScoreLabel.text = String(totalScore)
          }
          else {
              highScoreLabel.text = highScore.formatted()
          }
      }
      else {
          highScoreLabel.text = totalScore.formatted()
      }
  }
  func gameOver(){
       loadHighScore() 
       if let scoreVC =     storyboard!.instantiateViewControllerWithIdentifier("gameOver") as?    ScoreViewController {
                  scoreVC.score = self.totalScore
                  presentViewController(scoreVC, animated: true,      completion: nil)
  
        }
  //setting high score
          let score: Int? = NSUserDefaults.standardUserDefaults().valueForKey("highScore") as? Int
          if let highScore = score {
              if highScore &lt; totalScore {
                  NSUserDefaults.standardUserDefaults().setObject(totalScore, forKey: "highScore")
              }
              else {
                  //nothing
              }
          }
          else {
              NSUserDefaults.standardUserDefaults().setObject(totalScore, forKey: "highScore")
          }
          NSUserDefaults.standardUserDefaults().synchronize()
   }
  </code></pre>