Instead of NULL you should use -removeObjectForKey: The former is the official way to remove values, and the latter is undocumented behavior.
In any case, if using -removeObjectForKey: does not work, you can add a call
[[NSUserDefaults standardUserDefaults] synchronize];
in the end. But just do it if it doesn't work without him. The reason is that the -synchronize call -synchronize (relatively) expensive, so it needs to be done only when necessary to ensure correctness.
After another look, I suspect that your real problem is that this method is not called at all. On iOS 4 and later, when applications enter the background, they do not call this method, instead they call -applicationDidEnterBackground: Instead, you should try putting this code.
source share