views:

416

answers:

2

I've set up my app's user defaults to contain two toggle switches - one for help, one for sound. They are working however the starting values are false even though I've set them to be YES:

I use BOOL variables to track these values in the app, so I'd like to store YES/NO values. What else do I need to do to get the correct starting values?

A: 

Uhm... Aren't toggle switches setup this way:

http://screencast.com/t/bGCGIZara

Jongsma
The view I posted is iPhone Settings plist. In Xcode you can change it by going to View > Property List Type. If I select the Default view it looks like:<img src="http://i28.tinypic.com/2r6i3ib.jpg">
Ian
I see... But why are you specifying 'Value for ON' and 'Value for OFF'?
Jongsma
I tried Value for ON/OFF since both Help and Sound were defaulting to NO. I also tried using TrueValue/FalseValue, it didn't work. I don't understand what's wrong here, both settings always default to NO.
Ian
+1  A: 

I found the answer to this. Apparently there is an Application Domain AND a Registration Domain that aren't in sync the first time the app is run. The solution that worked for me is here:

http://excitabyte.wordpress.com/2009/08/12/keeping-user-defaults-synchronized-with-settings-bundle/

Not good when you want to have help and sound enabled the first time your app is run! Come on Apple.

Ian