How to delete a user default value in NSUserDefaults?
NSUserDefaults * removeUD = [NSUserDefaults standardUserDefaults];
[removeUD removeObjectForKey:@"shoping"];
[[NSUserDefaults standardUserDefaults]synchronize ];
Use this code
[[NSUserDefaults standardUserDefaults] removeObjectForKey:@"MyKey"];
dont forget to synchronize if you want to save immediately
[[NSUserDefaults standardUserDefaults] synchronize];
NSUserDefaults Class Reference
synchronize - This method is automatically invoked at periodic intervals, use this method only if you cannot wait for the automatic synchronization (for example, if your application is about to exit) or if you want to update the user defaults to what is on disk even though you have not made any changes.
Swift 5:
UserDefaults.standard.removeObject(forKey: "MyKey")
UserDefaults.standard.synchronize()
Try removeObjectForKey
-- that should give you the ability to remove a preference.