title: iPhone preferences (NSUserDefaults) not working, keys always return nil
body: <p>I made some preferences in my Settings.bundle that show up fine in the Settings app.   However my settings always return nil when I read them back.  I know I need to set a default value on first startup.  But even after that and going to the settings menu (which should also set the default values) - when I read them back I always get nil.  </p>
  
  <p>Even when I set the default and read it back immediately I get nil!</p>
  
  <pre><code>  NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    NSDictionary *appDefaults = [NSDictionary dictionaryWithObject:@"YES" forKey:@"displaySunTimes"];
    [defaults registerDefaults:appDefaults];
    [defaults synchronize];
  
    bool test =[defaults boolForKey:@"displaySunTimes"];
    NSLog(@" Value %@", test);
  </code></pre>
  
  <p>Here's the beginning of my root.plist</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;dict&gt;
      &lt;key&gt;StringsTable&lt;/key&gt;
      &lt;string&gt;Root&lt;/string&gt;
      &lt;key&gt;PreferenceSpecifiers&lt;/key&gt;
      &lt;array&gt;
              &lt;dict&gt;
                      &lt;key&gt;Type&lt;/key&gt;
                      &lt;string&gt;PSGroupSpecifier&lt;/string&gt;
                      &lt;key&gt;Title&lt;/key&gt;
                      &lt;string&gt;Display Sunrise / Sunset times for your location.&lt;/string&gt;
              &lt;/dict&gt;
              &lt;dict&gt;
                      &lt;key&gt;Type&lt;/key&gt;
                      &lt;string&gt;PSToggleSwitchSpecifier&lt;/string&gt;
                      &lt;key&gt;Title&lt;/key&gt;
                      &lt;string&gt;Sunrise / Sunset&lt;/string&gt;
                      &lt;key&gt;Key&lt;/key&gt;
                      &lt;string&gt;displaySunTimes&lt;/string&gt;
                      &lt;key&gt;DefaultValue&lt;/key&gt;
                      &lt;true/&gt;
                      &lt;key&gt;TrueValue&lt;/key&gt;
                      &lt;string&gt;YES&lt;/string&gt;
                      &lt;key&gt;FalseValue&lt;/key&gt;
                      &lt;string&gt;NO&lt;/string&gt;
              &lt;/dict&gt;
  </code></pre>