title: getting return value type of an instance method in runtime
body: <p>I want get the return value class of an instance in runtime. The thing it's that I have a <code>SEL</code> type var where I store a selector. I have a variable named <code>id _instance</code> that points to an instance that I know it performs the selector. Before perform the method I want to know if I have to do:</p>
  
  <pre><code>NSObject* returnValue=[_instance performSelector:_selector withObject:params.params];
  </code></pre>
  
  <p>or:</p>
  
  <pre><code>[_instance performSelector:_selector withObject:params.params];
  </code></pre>
  
  <p>I have read a <a href="https://stackoverflow.com/questions/7447559/in-objective-c-how-to-find-out-the-return-type-of-a-method-via-reflection">post where someone explain the way to have that with objective-c runtime</a>:</p>
  
  <pre><code>Method m = class_getClassMethod([_instance class], _selector);
  
  char ret[256];
  method_getReturnType(m, ret, 256);
  NSLog(@"Return type: %s", ret);
  </code></pre>
  
  <p>But the outputs is nothing like ret is empty.</p>
  
  <p>Really it can be enough to know if it's a void or have a return type but I don't know where to search. I have read the <a href="http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ObjCRuntimeRef/Reference/reference.html" rel="nofollow noreferrer">objective-c runtime reference</a> but the only thing I found is the <code>method_getReturnType...</code>. Any idea?</p>