title: Am I using NSUserDefaults wrong?
body: <p>I've created a "Settings" model for my iPhone app. It only contains two properties and a class method for loading and one instancemethod for saving.</p>
  
  <p>I load it as follows</p>
  
  <pre><code>+ (UserSettings *)getCurrent {
      NSUserDefaults *userPrefs = [NSUserDefaults standardUserDefaults];
      UserSettings *settings = [UserSettings new];
      settings.username = [userPrefs stringForKey:kUserNameKey];
      settings.password = [userPrefs stringForKey:kPasswordKey];
      [userPrefs release];
      return settings;
  }
  </code></pre>
  
  <p>The problem that the handling with the NSUserDefault casts an exception; </p>
  
  <blockquote>
    <p>-[NSCFArray objectForKey:]: unrecognized selector sent to instance
    0x50b220</p>
  </blockquote>
  
  <p>I have imported my header with the constants which are defined as follows;</p>
  
  <pre><code>#define kUserNameKey    @"Username"
  #define kPasswordKey    @"Password"
  </code></pre>
  
  <p>(I am aware of keychain and am planning on changing to that later on, but want to solve the userdefaults)</p>