Preference Files & Shared Default Controller

I continue to be perplexed by this. I have a field that is bound to shared user defaults. It works great. Now I want to reset everything for testing. I delete the preference file that is storing the defaults. Relaunch the app and all my last entries in that and other similarly bound fields are still there. Reboot, etc. no difference. The preferences seem frozen.

Any insight into this?

Running the latest macOS 10.3.4

Model: MacBook Pro with Touch Bar
AppleScript: 2.1
Browser: Safari 605.1.15
Operating System: Mac OS X (10.13 Developer Beta 3)

The prefs file is just a non-volatile store for user preferences; deleting it isn’t guaranteed to do anything. Once a script has been run, what matters is what the defaults process contains, until it decides to write it to disk and flush its entries.

If you want to kill the defaults, you need to quit the app and then use either the defaults command line tool’s delete function, or run a script like this:

use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "Foundation"
current application's NSUserDefaults's standardUserDefaults()'s removePersistentDomainForName:"com.your.app" -- change to app ID

If you are using Cocoa Bindings a shared instance of NSUserDefaultsController is used.

Register your initial values as usual and assign the dictionary also as InitialValues of the controller for example

set initialDefaults to {key1 : "Foo", Key2 : 10, Key3 : false}
        current application's NSUserDefaults's standardUserDefaults()'s registerDefaults:initialDefaults
        current application's NSUserDefaultsController's sharedUserDefaultsController()'s setInitialValues:initialDefaults

To reset all values programmatically call

current application's NSUserDefaultsController's sharedUserDefaultsController()'s revertToInitialValues: initialDefaults