title: How to get runtime Block type metadata in Objective-c?
body: <p>I'm writing a class where you register an object and a property to observe. When the property gets set to something non-<code>nil</code>, a registered callback selector is called (like target-action). The selector may have three different signatures, and the right one is called depending on which type was registered. </p>
  
  <p>This works fine, but now I want to add the ability to register a Block instead of a selector as the "callback function". Is it possible to find out the function signature of the supplied Block and handle the callback differently depending on the type of Block supplied?</p>
  
  <p>For example:</p>
  
  <pre><code>- (void)registerCallbackBlock:(id)block
  {
      if ([self isBlock:block] {
          if ([self isMethodSignatureOne:block]) { /* */ }
          else if ([self isMethodSignatureTwo:block]) { /* */ }
          else { assert(false); }  // bad Block signature
  
          block_ = block;  // assuming ARC code
      }
      else { assert(false); } // not a block
  } 
  
  - (void)callBlock 
  {
      if ([self isMethodSignatureOne:block_] {
          block_(arg1_, arg2_);         // needs casting?
      }
      else if ([self isMethodSignatureTwo:block_) {
          block_(arg1_, arg2_, arg3_);  // needs casting?
      }
  }
  </code></pre>
  
  <p>Any ideas? </p>
  
  <p>I know I can make different register functions with specific <code>typedef</code>'ed Block arguments but I would rather have a single function, if possible. </p>