Hi guys I am having problems with NSUserDefaults and I do not quite understand what is happening
My application has 5 levels, and each level does the same with NSUserDefaults (extracts the default levels, changes the value when the user plays the level, and then sets the default values and synchronizes at the end of the level) the first 4 levels ... work without a hitch but the last level does not save the value. The application does not crash, and the last level is not the last thing that happens, and I even have the default synchronization when the application terminates. Is there a maximum size in NSUserDefaults or is there anything that might think that I don’t have, I will post the code below, but as I said, the first four levels work fine
//header NSUserDefaults *userData; @property(nonatomic,retain) NSUserDefaults *userData; //class file //Sets the boolean variables for the class to use userData = [NSUserDefaults standardUserDefaults]; boolOne = [userData boolForKey:@"LevelFiveBoolOne"]; boolTwo = [userData boolForKey:@"LevelFiveBoolTwo"]; boolThree = [userData boolForKey:@"LevelFiveBoolThree"]; boolFour = [userData boolForKey:@"LevelFiveBoolFour"]; boolFive = [userData boolForKey:@"LevelFiveBoolFive"]; boolSix = [userData boolForKey:@"LevelFiveBoolSix"]; boolSeven = [userData boolForKey:@"LevelFiveBoolSeven"]; //End Of Level [userData setBool:boolOne forKey:@"LevelFiveBoolOne"]; [userData setBool:boolTwo forKey:@"LevelFiveBoolTwo"]; [userData setBool:boolThree forKey:@"LevelFiveBoolThree"]; [userData setBool:boolFour forKey:@"LevelFiveBoolFour"]; [userData setBool:boolFive forKey:@"LevelFiveBoolFive"]; [userData setBool:boolSix forKey:@"LevelFiveBoolSix"]; [userData setBool:boolSeven forKey:@"LevelFiveBoolSeven"]; [userData synchronize];
When, when switching to the view using these default values, they are correct, but when I exit the application and restart it, these values are not saved, each other level performs the same process, this is the only level that does not work.
I stared at this for quite some time, and I hope that someone there has encountered the same problem and can give me some idea of how they solved it.
Thank you at Advance BWC
iphone nsuserdefaults
Bwc
source share