NSUserDefaults can only process property list objects. Property list objects must be one of the following types: NSArray , NSDictionary , NSString , NSData strong>, NSData, and NSNumber .
NSUserDefaults has a number of helper methods that automatically convert numeric types to NSNumber objects. setInteger: forKey: and integerForKey: and helper methods for integers. These methods expect integers to be of type NSInteger . NSInteger is not an object. This is just a typedef for long int . Your code defines highScore as int . This may be causing the problem.
I prefer to convert c numeric types to NSNumber objects and store the object. Although this seems like extra work, it can simplify your code as everything returned by NSUerDefaults will be an object and can be handled in a uniform way.
Bromo source share