title: NSMutableDictionary EXC_BAD_ACCESS
body: <p>I know there are many questions about this topic but non of them work for me because mine is a little weird.</p>
  
  <p>First of all I create a static singleton class. and declare a variable of NSMutableDictionary</p>
  
  <pre><code>static NSMutableDictionary* mydic
  @implementation mySingleton
  
  -(mySingleton*)getInstance
  {
      static mySingleton *sharedInstance;
      @synchronized(self)
      {
         if(!sharedInstance)
         {
            sharedInstance = [[mySingleton alloc] init];
            mydic = [[NSMutableDictionary alloc] initWithCapacity:1];
         }
         return sharedInstance;
      }
  }
  
  -(NSMutableDictionary*)getDictionary
  {
     return myDic;
  }
  </code></pre>
  
  <p>then I call this NSMutableDictionary from another class like the below.</p>
  
  <pre><code>NSMutableDictionary* singletonDictionary = [[mySingleton getInstance] getDictionary];
  
  MyOtherClass* myclass = [singletonDictionary objectForKey:key];// Key is NSString
  // Here I can see whole the values I added to myClass for that key
  NSArray *checkKey = [singletonDictionary allKeys];
  for(int i = 0; i &lt; [singletonDictionary count]; i++)
  {
      NSLog(@"%@",[checkKey objectAtIndex:i]);// here I can see my key is there
  }
  
  [singletonDictionary removeObjectForKey:key];// here it crashes EXC_BAD_ACCESS
  </code></pre>
  
  <p>I am gonna get crazy about this problem. If someone has an idea please share it with me.</p>
  
  <p><strong>EDIT :</strong> </p>
  
  <pre><code>MyOtherClass * myinstance = [[MyOtherClass alloc] init];
  // Fill up the instance with the desired variable here
  // Forexample
  // myinstance.name = [NSString stringWithFormat:@"myInstanceName"];
  .
  .
  .
  
  [[[mySingleton getInstance] getDictionary] setObject:myinstance forKey:key]// key is an NSString*
  [myinstance release];
  </code></pre>
  
  <p>Thanks for help.</p>
  
  <p>Omer Faruk KURT</p>