NSUserDefaults during development.
It turns out that if you’re working on an OS X app that is sandboxed and you have reason (possibly frequent during development) to delete the app’s sandbox container from ~/Library/Containers/ then attempts from within the app to write out to its defaults database might be failing silently. (A call to -[NSUserDefaults synchronize]
will even return YES
, giving the impression of success.)
This post on the Apple dev forums (login needed) indicates that on 10.9 the prefs system caches stuff really aggressively and is confused by you deleting the container. The workaround is to either restart the computer altogether, or to open a shell and restart the prefs daemon by running killall -SIGTERM cfprefsd
.