title: Can't Send NSMutableDictionary To Another Class
body: <p>All,</p>
  
  <p>I'm trying to send the NSMutableDictionary "response" to another class of mine, or rather, have the other class pull the dictionary from this class. When the other class uses the "getResponse" method, it returns null. </p>
  
  <p>The code I have attached is my XML parser, which is what puts the information I need into the dictionary. At the very bottom is the method that shows "(null)" in the NSLog. I have commented it for you. </p>
  
  <p><strong>EDIT: I do use the initXMLParser method to initialize in the other class. But even still, accessing within this class doesn't even work. In the getResponse method that displays the response dictionary, the NSLog doesn't display anything but "TEST(null)".</strong></p>
  
  <pre><code>#import "XMLParser.h"
  
  @implementation XMLParser
  
  @synthesize response;
  
  
  - (id)init
  {
      self = [super init];
      if (self) {
          // Initialization code here.
      }
  
      return self;
  }
  
  - (XMLParser *) initXMLParser //not sure if this is necessary anymore - CHECK THIS
  {
      self = [super init];
      // init array of return data 
      NSLog(@"Initializing self and super...");
      response = [[NSMutableDictionary alloc] init];
      count = 1;
      return self;
  }
  
  //Gets Start Element of SessionData
  - (void)parser:(NSXMLParser *)parser 
          didStartElement:(NSString *)elementName 
          namespaceURI:(NSString *)namespaceURI 
          qualifiedName:(NSString *)qualifiedName 
          attributes:(NSDictionary *)attributeDict 
  {
  
      if ([elementName isEqualToString:@"SessionData"]) 
      {
          NSLog(@"Found SessionData in the return XML! Continuing...");
          //response is a NSMutableArray instance variable (see .h of this)
          if (!response)//if array is empty, it makes it!
          {
          NSLog(@"Dictionary is empty for some reason, creating...");
              response = [[NSMutableDictionary alloc] init];
              count=1;
          }
          return;
      }
      else
      {
          currentElementName = elementName;
          NSLog(@"Current Element Name = %@", currentElementName);
          return;
      }
  }
  
  - (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string 
  {
      if (!currentElementValue) {
          // init the ad hoc string with the value     
          currentElementValue = [[NSMutableString alloc] initWithString:string];
      } else {
          // append value to the ad hoc string    
          [currentElementValue setString:string];
          NSLog(@"Processing value for : %@", string);
      }
  }  
  
  //Gets End Element of SessionData
  - (void)parser:(NSXMLParser *)parser 
   didEndElement:(NSString *)elementName
    namespaceURI:(NSString *)namespaceURI 
   qualifiedName:(NSString *)qName {
  
      if ([elementName isEqualToString:@"SessionData"]) 
      {
          // We reached the end of the XML document
          //dumps dictionary into log
          NSLog(@"Dump:%@", [response description]);
          return;
      }
      else
      {
          //Adds key and object to dictionary
          [response setObject:currentElementValue forKey:currentElementName];
          NSLog(@"Set values, going around again... brb.");
      }
      currentElementValue = nil;
      currentElementName = nil;
  }
  
  - (NSMutableDictionary*)getResponse
  {
      NSLog(@"%@", [self response]; //THIS RETURNS NULL
      return response;
  }
  
  
  @end
  </code></pre>