title: How to return a id<protocol_type> in iOS
body: <p>I have a function , return a protocol.</p>
  
  <p>But Xcode waring: 
  [Returning 'HpadMoblieCollectorBooleanResult *'__strong from a function with incompatible result type 'id' ] </p>
  
  <p>-----------sep line ---------------------</p>
  
  <p>Question detail :</p>
  
  <pre><code>HpadCollectorBooleanResult.h
  
  @protocol HpadCollectorBooleanResult &lt;NSObject&gt;
  - (void) result:(void(^)(BOOL))block ; 
  @end
  </code></pre>
  
  <p>I have a Class to implement HpadCollectorBooleanResult protocol ,
  the Class is HpadMoblieCollector .</p>
  
  <h2>HpadMoblieCollector.h</h2>
  
  <pre><code>    #import "HpadCollectorResult.h"
  
      @interface HpadMoblieCollector : NSObject
  
      // clear All
      - (id&lt;HpadCollectorBooleanResult&gt;) favorite_ajax_clear ;
  
      @end 
  </code></pre>
  
  <p>and the .m file is </p>
  
  <h2>HpadMoblieCollector.m</h2>
  
  <pre><code>@interface HpadMoblieCollectorBooleanResult&lt;HpadCollectorBooleanResult&gt; : NSObject
  {
      void(^_result)(BOOL) ;
      BOOL isExe ;
      BOOL resultFlag ;
  }
  
  @end
  
  @implementation HpadMoblieCollector
  
   // 清空手机收藏夹
  - (id&lt;HpadCollectorBooleanResult&gt;) favorite_ajax_clear
  {
      HpadMoblieCollectorBooleanResult *result = [[HpadMoblieCollectorBooleanResult alloc] init] ;
      return result ;  
  
  // Xcode waring: 
  // Returning 'HpadMoblieCollectorBooleanResult *'__strong from a function 
  // with incompatible result type 'id&lt;HpadCollectorBooleanResult&gt;' 
  }
  
  @end
  </code></pre>
  
  <p>You can see , the method "- (id&lt; HpadCollectorBooleanResult >) favorite_ajax_clear"  have an error ,
  I cannot solve the problem .</p>
  
  <p>1、Can you tell me why the Xcode send a warning message ? </p>
  
  <p>2、Can you help me to resolve it ?</p>