Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

alexandergre

macrumors member
Original poster
xcode says it has no errors but it does. This code is to add Highscore to the Highscore list.
Is this really the simplest way?
Code:
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
	if (buttonIndex == 0)
	{
		NSLog(@"Score saving cancelled");

	}
	else
	{
		NSLog(@"Adding score...");
		

		NSMutableArray *ScoresArray= [NSMutableArray array];;
		NSMutableArray *NamesArray= [NSMutableArray array];;
		NSLog(@"Arrays created");
		
		NSString *NameToSave = SaveName;
		NSString *ScoreToSave= [NSString stringWithFormat:@"%d", points];
		NSLog(@"Strings created");
		
		[ScoresArray addObject:ScoreToSave];
		[NamesArray addObject:NameToSave];
		NSLog(@"Added to Arrays");
		
		NSUserDefaults *ScoresDefaults =[NSUserDefaults standardUserDefaults];
		[ScoresDefaults setObject:NamesArray forKey:@"NamesKey"];
		[ScoresDefaults setObject:ScoresArray forKey:@"ScoresKey"];
		NSLog(@"Score saved in NSUserDefaults");

		}
}
 
NSMutableArray *ScoresArray= [NSMutableArray array];;
NSMutableArray *NamesArray= [NSMutableArray array];;

Typically, you should only have one semi-colon at the end...unless this is something new.
 
Typically, you should only have one semi-colon at the end...unless this is something new.

Yes, but I doubt that would cause a problem, since it just means end of line. I just added another semi-colon to the end of one of my codings and I got no errors.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.