Consider the following example:
NSUserDefaults *def = [NSUserDefaults standardUserDefaults];
[def synchronize];
if([def objectForKey:@"Test_Value_1"] != nil){
[def removeObjectForKey:@"Test_Value_1"];
[def setBool:YES forKey:@"Test_Value_2"];
}
if (![def boolForKey:@"Test_Value_2"]){
...
}
Is is possible that the Test_Value_1 gets removed but the Test_Value_2 is not set? I'm not synchronizing after i change these values. My understanding is that the changes will kept in memory and then synchronized at some time later. So i should be save. The only possible way would be if after [def removeObjectForKey:@"Test_Value_1"];
the app would crash but i think thats highly unlikely.