title: iphone dev - NSUserDefaults check for boolean existence
body: <p>I've just added a settings bundle to my app and am having trouble reading the bool settings. I know that upon launch of the app, the settings are not read unless the user actually enters them - and that's what I am trying to capture. </p>
  
  <p>However, my code is simply capturing if the answer is NO OR they havent been set. I need to find out if they've been set, THEN set answers! </p>
  
  <p>setting code:</p>
  
  <pre><code>BOOL playSound;
  BOOL playVibrate;
  
  
  //test for some defaults
  NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
  if (![prefs boolForKey:@"pref_sound"]) {
      playSound = YES;
      playVibrate = YES; 
  } else {
      playSound = [prefs boolForKey:@"pref_sound"];
      playVibrate = [prefs boolForKey:@"pref_vibrate"]; 
  }
  
  
  if (playSound) {
  //do stuff
  }
  </code></pre>
  
  <p>the problem is, if the user sets the settings to "NO", the code then changes both vibrate AND sound to yes - which is meant to be the capture for NOT setting....</p>
  
  <p>any ideas?</p>