NSUserDefaults for high score is not working on iOS 8 Simulator? <p>I've tried to synchronize the saved data but my game still does not store the highest score. I can't find whats wrong with the replacing of the highScore with score if it is higher. Sorry I'm a beginner who just started learning iOS programming.</p> <pre><code>init(size: CGSize, score: NSInteger) { super.init(size: size) self.backgroundColor = SKColor.whiteColor() //To save highest score var highscore = 0 let userDefaults = NSUserDefaults.standardUserDefaults() if (score &gt; highscore){ NSUserDefaults.standardUserDefaults().setObject(score, forKey: "highscore") NSUserDefaults.standardUserDefaults().synchronize() } var savedScore: Int = NSUserDefaults.standardUserDefaults().objectForKey("highscore") as! Int //To get the saved score var savedScore: Int = NSUserDefaults.standardUserDefaults().objectForKey("highscore") as! Int </code></pre>