title: Clear a NSDictionary of NSarrays
body: <p>I spent a lot of time trying hundreds of things, and searching on the internet for my problem, but I didn't find anythig, so I hope you guys will be able to help me :).</p>
  
  <p>So, I have an <code>NSMutableDictionary</code> that I populate with <code>NSArrays</code> when I parse an XML document. My problem is, I want to empty it before I release it because it appears to cause leaks !</p>
  
  <p>Best solution, to my eyes, is : <code>[myDict removeObjectsForKeys : [myDict allKeys]]</code> but the app crashes and I get the following message in the console :</p>
  
  <p><code>*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSCFArray objectAtIndex:]: index (0) beyond bounds (0)'</code></p>
  
  <p>I really can't figure why... any ideas ?</p>
  
  <p>EDIT</p>
  
  <p>Important point I forgot  (I guess...), is that the dictionary I'm calling is in my application Delegate, with <code>appDelegate = [[UIApplication sharedApplication] delegate];</code>. (appDelegate defined in my .h with myAppDelegate class type).</p>
  
  <p>Then, I initialize it like this : <code>appDelegate.myDict = [[NSMutableDictionary alloc] init];</code></p>
  
  <p>Is it wrong ?</p>
  
  <p>What's weird then, is that when I do :</p>
  
  <pre><code>    [appDelegate.myDict release];
      NSLog( @"%@", appDelegate.myDict);
  </code></pre>
  
  <p>I get the dictionary filled...</p>
  
  <p>EDIT 2</p>
  
  <p>I just figured out that all my appDelegate variables are not released when I call <code>[appDelegate.myVariable release]</code> ... Wtf am I doing wrong ? This is driving me crazy >&lt;</p>