Sean,

Thank you, but that only demonstrates the bit I have working. What is not working for me is using registerDefaults.

Thanks anyway :)

On 16 March 2012 13:32, Sean Mateus <seanlilmateus@googlemail.com> wrote:
Hi Erik,

here is an example app Matt wrote:
   save: https://github.com/mattetti/LiveTV/blob/master/TVFrancaise/AppDelegate.rb#L249-253
   read: https://github.com/mattetti/LiveTV/blob/master/TVFrancaise/AppDelegate.rb#L41-42

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