Why am I unable to register default values in NSUserDefaults, Applescript Objc?
No matter what I do, the values that I register as default, using NSUserDefaults in my Cocoa-Applescript application (in Xcode), return "missing value" when I try to retrieve the values associated with their key.
Here's the code I'm using:
my RegisterKeyDefault:{"Username", "red_menace"}
on RegisterKeyDefault:{Key_ as text, Value_ as text}
tell standardUserDefaults() of (current application)'s NSUserDefaults to registerDefaults:{Key_:Value_}
end RegisterKeyDefault:
Keep in mind that in Xcode, the call to the function is in the function called at launch, and the function I made is outside of that function. I don't get any compiling errors or errors while running the app.
I also checked the saved values using the "defaults" command in Terminal, and none of them were saved there either.
What am I doing wrong?
Edit:
When I arbitrarily set the the value of the key, then it saves.