I'm having trouble figuring out why NSUserDefaults
is leaving junk plist files in Library/Preferences for my app.
I'm seeing the following files...
com.mycompany.myapp.plist
com.mycompany.myapp.plist.3gaPYul
com.mycompany.myapp.plist.c97yxEH
... etc. The plist.*
files are 0 bytes. It seems that everytime the app is run, it leaves a new one behind. I made sure I'm not calling -[NSUserDefaults synchronize]
at all, however if I do call it, it hastens the junk files appearance for a given run. Stepping through in a debugger, as soon as i step over the call to synchronize, a new file has appeared. If I take out the synchronize call, a new junk file appears sometimes on app start, other times on app quit.
I'm also checking to see if maybe I'm setting a user default on a thread (unlikely, but a possibility perhaps), thought the docs say it is thread safe.
Any help is appreciated. Thanks!
EDIT:
Just found this: CFPreferences creates multiple files
While I agree with the answerers idea, it doesn't explain the "Why?" part.