title: HttpRequest Body parameters in iOS
body: <p>I am using web service for my iOS app.
  I know how to send http post request via URL (not http Body) and get response using NSURLConnection Delegate.
  But now there is better approach which I am following for web service and passing parameters in request body. I looked for library on google and found <a href="https://github.com/pokeb/asi-http-request" rel="nofollow noreferrer">this</a>.</p>
  <p>But the code is bit difficult for me and I suppose there should be function for the same, which can make this bit easier.
  Is there any? the code so far is below.</p>
  <pre><code>NSMutableURLRequest *request = [[NSMutableURLRequest alloc] 
      initWithURL:[NSURL 
      URLWithString:**WebService URL**]];
  
  [request setHTTPMethod:@&quot;POST&quot;];
  [request setValue:@&quot;text/json&quot; forHTTPHeaderField:@&quot;Content-type&quot;];
  
  NSString *jsonString = [NSString stringWithFormat:@&quot;{\n\&quot;username\&quot;:\&quot;%@\&quot;,\n\&quot;%@\&quot;:\&quot;%@\&quot;,\n\&quot;%@\&quot;:\&quot;%@\&quot;,\n\&quot;%@\&quot;:%@,\n\&quot;%@\&quot;:%@,\n\&quot;version\&quot;:%@,\n\&quot;name\&quot;:\&quot;%@\&quot;\n}&quot;,userName, @&quot;password&quot;,pass,@&quot;accessToken&quot;,token,@&quot;isOnline&quot;,@&quot;True&quot;,@&quot;accountType&quot;,type,@&quot;False&quot;,name];
  
  [request setHTTPBody:[jsonString dataUsingEncoding:NSUTF8StringEncoding]];
  
  [[NSURLConnection alloc] initWithRequest:request delegate:self];
  </code></pre>
  <p>jsonString in this code is the http body. I want to pass parameters in request body.
  Now, after executing this code i get null in NSData variable. whereas my web service function returns a value and also it returns if the execution was successful.
  what is wrong in my code.
  Thank you.</p>