title: Returning a BOOL method inside a block?
body: <p>I have this bool method that returns a yes or no for an inputted string.
  I'm successfully able to return a <code>YES</code> or a <code>NO</code>, but I cannot seem to able to make a network connection and return a <code>YES</code> or a <code>NO</code> depending on the server's response.
  I tried using <code>__block</code> and I don't feel like that will wait for the web request to finish, is there a way to return <code>YES</code> or <code>NO</code> in the success block without it giving me the error:</p>
  
  <blockquote>
    <p>Incompatible block pointer types sending 'BOOL(^)(NSURLSessionTask*__strong, NSError <em>__strong' to parameter of the type 'void(^)(NSURLSessionTask</em>...)</p>
  </blockquote>
  
  <pre><code>-(BOOL)customResponseForString:(NSString *)text {
  
    __block BOOL response_available;
  
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
      AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
      manager.responseSerializer = [AFHTTPResponseSerializer serializer];
      [manager.responseSerializer setAcceptableContentTypes:[NSSet setWithObject:@"text/plain"]];
      [manager GET:[NSString stringWithFormat:@"http://example.com/response.php?input=%@", text] parameters:nil success:^(NSURLSessionDataTask *task, id responseObject) {
  
          NSDictionary *response = [NSJSONSerialization JSONObjectWithData:responseObject options:NSUTF8StringEncoding error:nil];
          response_available = (BOOL)response[@"response_available"];
          if (response_available) {
              [session sendTextSnippet:response[@"response"] temporary:NO scrollToTop:NO dialogPhase:@"Summary"];
          } else {
              response_available = NO;
          }
  
          [session sendTextSnippet:[[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding] temporary:NO scrollToTop:NO dialogPhase:@"Summary"];
  
          [session sendRequestCompleted];
  
      } failure:^(NSURLSessionDataTask *task, NSError *error) {
          //return NO;
      }];
   });
  
  return response_available;
  
  }
  </code></pre>