title: Sending json post from xcode to wep.api
body: <p>I'm having troubles sending a post message to my Wep.api application. I already tried my wep.api on google chrome postman application and it works perfectly. I want my code in the xcode to send this json message to my wep.api</p>
  
  <pre><code>Content-Type: application/json; charset=utf-8
  { UserName: "fjkdlajfka", DeviceID: "1568948" , Password: "fkjdalfda"}
  </code></pre>
  
  <p>But everytime i send the message, I keep getting null on the parameters. this is my xcode message:</p>
  
  <pre><code>NSString *JsonMsg = [NSString stringWithFormat:@"{UserName: \"%@\",DeviceID: \"%@\",Password: \"%@\"}",
                       Username.text,@"123456789",Password.text];
  NSURL *url = [NSURL URLWithString: @"http://192.168.xxx.xxxx:53913/api/LogIn"];
  NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];
  NSString *msgLength = [NSString stringWithFormat:@"%d", [JsonMsg length]];
  
  [theRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
  [theRequest setValue:@"application/json" forHTTPHeaderField:@"Accept"];
  [theRequest setValue:msgLength forHTTPHeaderField:@"Content-Length"];
  [theRequest setHTTPMethod:@"POST"];
  [theRequest setHTTPBody:[JsonMsg dataUsingEncoding:NSUTF16BigEndianStringEncoding allowLossyConversion:YES]];
  
  conn = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
  
  if ( conn ) {
      webData = [NSMutableData data];
  
  }
  else {
      NSLog(@"theConnection is NULL");
  }
  </code></pre>
  
  <p>Does anyone know whats the error here?</p>