Im trying to save a high score using
HighScore = [[NSUserDefaults standardUserDefaults]integerForKey:@"ScoreSaved"];
Intro3.text = [NSString stringWithFormat:@"HighScore: %i", HighScore];
it says :
"implicit conversion loses integer precision, NSInterger(aka long) to int
-(void)EndGame
{
if (ScoreNumber > HighScore){
HighScore = ScoreNumber;
[[NSUserDefaults standardUserDefaults]setInteger:HighScore forKey:@"ScoreSaved"];
}
this is my first game and i am stuck how would i save a high score? thank you for taking the time to read this.
You are using the wrong specifier with
stringWithFormat, however getting the right one is difficult if you want to support both 32- and 64-bit targets. It's often easier to use%ldand cast the value tolong: