title: Delete all keys from a NSUserDefaults dictionary iOS
body: <p>I use the NSUserDefaults dictionary to store basic information such as high scores etc so that when the user closes the app data is not lost. Anyways I use:</p>
  
  <pre><code>NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
  </code></pre>
  
  <p>to store data. If I wish to store a new high score for example then I would do:</p>
  
  <pre><code>[prefs setInteger:1023 forKey:@"highScore"];
  [prefs synchronize];  //this is needed in case the app is closed. 
  </code></pre>
  
  <p>and later if I wish to retrieve the high score I would do:</p>
  
  <pre><code>[prefs integerForKey:@"highScore"];
  </code></pre>
  
  <p>anyways the point is that I store a lot of other things because the <code>NSUserDefaults enable</code> you to store <code>booleans</code>, <code>integers</code>, <code>objects</code> etc.   what method would I have to execute to delete all keys so that NSUserDefaults becomes like the fist time I launch the app?</p>
  
  <p>I am looking for something like:</p>
  
  <pre><code>NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
  [prefs deleteAllKeysAndObjectsInTheDictionary];
  </code></pre>
  
  <p>or maybe there is a way of getting all keys and I have to loop through each object but I don't know how to remove them. </p>
  
  <p>EDIT:</p>
  
  <p>I have tried :</p>
  
  <pre><code>NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
  [NSUserDefaults resetStandardUserDefaults];
  [prefs synchronize];
  </code></pre>
  
  <p>and I still am able to retrieve a high score....</p>