title: objective c completion handler
body: <p>I have RequestManager class with getContentInBackgroundWithMemberId and postRequest functions. I want to call them from my view controller and get result using completion handler. How to edit my functions?</p>
  
  <p>RequestManager.h</p>
  
  <pre><code>#import &lt;Foundation/Foundation.h&gt;
  
  @interface RequestManager : NSObject
  
  -(void)getContentInBackgroundWithMemberId:(int)memberId;
  
  @end
  </code></pre>
  
  <p>RequestManager.m</p>
  
  <pre><code>#import "RequestManager.h"
  
  @implementation RequestManager
  
  
  -(void)postRequestWithParams:(NSDictionary*)params
  {
  NSString *parameters = @"encrypt=93mrLIMApU1lNM619WzZje4S9EeI4L2L";
  for(id key in params)
  {
     NSString *obj = [NSString stringWithFormat:@"&amp;%@=%@",key,[params objectForKey:key]];
     [parameters stringByAppendingString:obj];
  }
  
  NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
  [request setURL:[NSURL URLWithString:@"http://someserver"]];
  
  NSData *postBody = [parameters dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
  [request setHTTPMethod:@"POST"];
  [request setHTTPBody:postBody];
  [NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse * _Nullable response, NSData * _Nullable data, NSError * _Nullable connectionError) {
      if(!connectionError)
      {
          NSDictionary *serverData =[NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
          NSArray *result = [NSArray array];
          result = [serverData objectForKey:@"result"];
      }
  
  }];
  }
  
  
  -(void)getContentInBackgroundWithMemberId:(int)memberId
  {
  NSDictionary *params = [NSDictionary dictionary];
  params = @{@"member_id":[NSNumber numberWithInt:memberId]};
  
  [self postRequestWithParams:params];
  }
  
  @end
  </code></pre>
  
  <p>ViewController.h</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  #import "RequestManager.h"
  
  @interface ViewController : UIViewController
  
  @property (strong,nonatomic) RequestManager *requestManager;
  
  @end
  </code></pre>
  
  <p>ViewController.m</p>
  
  <pre><code>#import "ViewController.h"
  
  @interface ViewController
  
  @end
  
  @implementation ViewController
  
  - (void)viewDidLoad {
  
  [super viewDidLoad];
  
  int memberId = 82;
  
  //here i want to call getContentInBackgroundWithMemberId and get result using completion handler;
  _requestManager = [[RequestManager alloc]init];
  [_requestManager getContentInBackgroundWithMemberId:memberId];
  
  }
  
  @end
  </code></pre>