Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>There are multiple Errors in your Code, Use my Code as a Reference and compare it to yours and you'll get the Errors done by you. The Below code is working correctly from the Point of View of Objective-C. There are some Errors regarding your URL or Service Side.</p> <p><strong>Working Code :</strong></p> <pre><code>NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithObjectsAndKeys:@"ann",@"uname",@"ann",@"pwd",@"login",@"req", nil]; NSLog(@"dict :: %@",dict); NSError *error2; NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dict options:kNilOptions error:&amp;error2]; NSString *post = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]; NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]]; NSLog(@"postLength :: %@",postLength); NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init]; [request setURL:[NSURL URLWithString:@"http://exemplarr-itsolutions.com/dbook/index.php"]]; [request setHTTPMethod:@"POST"]; [request setValue:postLength forHTTPHeaderField:@"Content-Length"]; [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"]; [request setValue:@"application/json" forHTTPHeaderField:@"Accept"]; [request setHTTPBody:postData]; NSURLResponse *response; NSError *error3; NSData *POSTReply = [NSURLConnection sendSynchronousRequest:request returningResponse:&amp;response error:&amp;error3]; NSString *str = [[NSString alloc] initWithData:POSTReply encoding:NSUTF8StringEncoding]; NSLog(@"str :: %@",str); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload