title: What is the syntax/signature of a Objective-C method that returns a block without typedef?
body: <p>I defined a block that takes an <code>NSString</code> and returns a <code>NSURL</code> for that string:</p>
  
  <pre><code>id (^)(id obj)
  </code></pre>
  
  <p>I've used <code>typedef</code> to make it a block with a name:</p>
  
  <pre><code>typedef id (^URLTransformer)(id);
  </code></pre>
  
  <p>And the following method does not work:</p>
  
  <pre><code>+ (URLTransformer)transformerToUrlWithString:(NSString *)urlStr
  {
      return Block_copy(^(id obj){
          if ([obj isKindOfClass:NSString.class])
          {
              NSString *urlStr = obj;
              return [NSURL URLWithString:[urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
          }
          return nil; // **THIS LINE FAILS**
      });
  }
  </code></pre>
  
  <p>Error:</p>
  
  <blockquote>
    <p>Return type 'void *' must match previous return type 'id' when block
    literal has unspecified explicit return type</p>
  </blockquote>
  
  <p>My question is:
  1. how to correctly implement the method
  2. how to implement the method without typedef URLTransformer?</p>
  
  <p>Thanks</p>