Where are NSUserDefaults stored on El Capitan? -


in mac xcode project have bundle identifier of "com.gargoylesoft.dts-macos". i'm trying blow away stored defaults on user did this:

find ~ -name 'com.gargoylesoft.d*' -exec rm -rf {} \;

when run app, through xcode, i'm still getting values previous runs when query nsuserdefauls. in world storing this???

you must never delete (or edit) preference files directly on macos! macos caches preferences using background daemon named cfprefsd. daemon won't notice delete (or alter) files, keeps cached copy in ram expire if system gets memory pressure. memory pressure means: app needs ram no unused ram available, system signals memory pressure, causing kind of system services flush caches still better swapping disk (will work in own application, try use nscache when caching data, automatically react memory pressure).

if want delete prefs, use defaults in terminal, this

# defaults delete com.gargoylesoft.dts-macos 

this delete file , make sure cfprefsd flushes caches file.

another advantage of defaults don't need know if application sandboxed or not, normal application stores prefs in

~/library/preferences 

whereas sandoxed 1 stores them in

~/library/containers/bundle_id/data/library/preferences/ 

but defaultswill in appropriate place.

once deleted pref file hand, need kill cfprefsd of user (careful, there's 1 user , 1 root - don't want kill root 1 if these user settings) , system should restart you. or reboot or @ least log out , in, both restart well.


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -