Ok, I’ve tried a bunch of examples on here, but I just can’t get it to work. Could someone please post a quick step-by-step instruction on how to store and recall a preference of an integer, let’s say it’s called “r1Feet”? This integer value is bound to a text field, so I can’t use bindings for the preferences. I seem to be missing something obvious, but I just can’t get it to work. This is what I have tried so far:
I put this in my applicationWillFinishLaunching_:
tell current application's NSUserDefaults to set defaults to standardUserDefaults()
tell defaults to registerDefaults_({r1FeetKVC:9998})
Then I call this method in my applicationWillFinishLaunching_:
on retrieveDefaults_(sender)
tell defaults to set r1Feet to integerForKey_("r1FeetKVC")
end retrieveDefaults_
Then I try to call this method in my applicationShouldTerminate_, but if I put the call in there, the application won’t quit.
on saveDefaults_(sender)
tell defaults to setInteger_forKey_(r1Feet, "r1FeetKVC")
end saveDefaults_
Please help. Thanks so much.