Sean,
Hi Erik,here is an example app Matt wrote:I hope this will help you-- Sean Mateus
On Friday, March 16, 2012 9:59:38 AM UTC+1, Erik Lundqvist wrote:Hi All,It's time for my first newbie question :)Trying to save some default values for user preferences, but failing pretty hard. I was hoping someone would have successfully used NSUserDefaults registerDefaults, and could point me in the right direction.def applicationDidFinishLaunching(a_notification)
app_defaults = {"wcff.magic_key" => "hello world"}
NSUserDefaults.standardUserDefaults.registerDefaults(app_defaults)
NSUserDefaults.standardUserDefaults.synchronize
end
Elsewhere in the code...
@magic_key = NSUserDefaults.standardUserDefaults["wcff.magic_key"]
puts "magic_key#{@magic_key}"
It just prints out "magic_key"...
Actually setting a value in standardUserDefaults seems to work fine, like this
NSUserDefaults.standardUserDefaults["wcff.magic_key"] = "hello you"
But I want a default
Anyone?
_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel