I am trying for an HTTP call on https. Here is my code snippet.
NSMutableURLRequest *request = [[NSMutableURLRequest alloc]
initWithURL:[NSURL
URLWithString:@"https://testservice.fiamm.com/token"]];
[request setHTTPMethod:@"POST"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-type"];
NSString *postString = @"username=TestIphone&Password=T3st1ph$n&Grant_type=password";
[request setValue:[NSString stringWithFormat:@"%d", [postString length]] forHTTPHeaderField:@"Content-length"];
[request setHTTPBody:[postString
dataUsingEncoding:NSUTF8StringEncoding]];
// Fetch the JSON response
NSData *urlData;
NSURLResponse *response;
NSError *error;
// Make synchronous request
urlData = [NSURLConnection sendSynchronousRequest:request
returningResponse:&response
error:&error];
// Construct a String around the Data from the response
NSString *strFiamm = [[NSString alloc] initWithData:urlData encoding:NSUTF8StringEncoding];
When I try in hurl or postman I get response proper but when I try in my code I get this error.
NSURLConnection/CFURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813)
Any help or suggestions appreciated.!