If you synchronize when you close the application, for example:
- (void)applicationWillResignActive:(UIApplication *)application { [[NSUserDefaults standardUserDefaults] synchronize]; // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. }
First, he will try to write to the dummy file and then perform atomic renaming. If the recording takes a long time, you will get a dummy file.
In my case, I had several users with 14mb plists and as a result there were a lot of dummy files (taking almost 2G).
My problem and fix was to compress the image I wrote for userdefaults.
Sjoerd perfors
source share