I have a sandboxed app for OSX and I saved some data in NSUserDefaults
, everything was fine until I deleted the plist file from the ~Library/Preferences/ directory.
I thought the app should recreat it but it did not. When I debug I see that
[[NSUserDefaults standardUserDefaults] synchronize]
method returns YES
and data are saved in the class but when I restart the app user defaults is empty.
Even if I copy those plist file from backup to the Preferences directory, the app does not see it.
Of course the plist should be saved in the Containers/my app bundle id/Data/Library/Preferences and when I copy the plist file from backup to that directory, the app can see it, but why that file is not recreated when I deleted it?
Does anybody know why is that?