title: Storing/Extracting Objects to/from NSDictionary
body: <p>I am getting errors using a NSDictionary when trying to assign it's contents to new variables/objects. Maybe this isn't posible? I thought it would be. I'm also not sure if I can use non-Objective C specific objects in the dictionary. Can you?</p>
  
  <pre><code>NSDictionary *preProcessResult = [[NSDictionary alloc] initWithDictionary: [self preProcessing:testImage]];
  IplImage* resultImage = [preProcessResult objectForKey:@"ResultImage"];
  int numChars = [preProcessResult objectForKey:@"NumberChars"];
  [preProcessResult release];
  </code></pre>
  
  <p>And here is the method I am calling to create the dictionary:</p>
  
  <pre><code>- (NSDictionary*) preProcessing: (IplImage*) testImage {
  
  //do stuff to image
  
  NSDictionary *testImage_andNumChars = [NSDictionary dictionaryWithObjectsAndKeys:resultImage, 
  @"ResultImage", numChars, @"NumberChars", nil];
  
  return testImage_andNumChars;
  }
  </code></pre>
  
  <p>Is this not the correct way to handle this? The error I get when I create the dictionary is:</p>
  
  <p>"Cannot convert 'IplImage*' to 'objc_object*' in argument passing"</p>
  
  <p>and when I retrieve the dictionary elements I get:</p>
  
  <p>"Cannot convert 'objc_object*' to 'IplImage*' in initialization" and "Invalid conversion from 'objc_object*' to 'int' ".</p>
  
  <p>I've read the Apple docs on NSDictionary which got me this far, but I am not sure where to go from here.</p>
  
  <p>Thanks in advance.</p>