I am using NSUserDefaults to set an NSInteger
But for some reason this isn't working. Keep in mind this is being done in different view controllers, and it needs to be done in many other view controllers.
Code:
NSUserDefaults *saveFile = [NSUserDefaults standardUserDefaults];
[saveFile setInteger:2 forKey:@"saveKey"];
This is working as a save game function.
Then in another view controller I am using the following code to load the game
NSUserDefaults *saveFile = [NSUserDefaults standardUserDefaults];
NSInteger saveInt = [saveFile integerForKey:@"integerKey"];
if (saveInt == 2) {
L2Raul1ViewController * raul1 = [[L2Raul1ViewController alloc]initWithNibName:nil bundle:nil];
[self presentModalViewController:raul1 animated:YES];
}
Last edited by a moderator: