0

Using NSURLConnection sendAsynchronousRequest:queue:completionHandler:to render data from server.

Development environment uses http, while Production environment uses https.

Data's are fetched from server in development environment. But failed to render data in production environment.

Why it is failing in production environment (HTTPS).

Ashok Londhe
  • 1,491
  • 11
  • 29
  • M. [refer post for additional setup required to pull data from `https` domain.](http://stackoverflow.com/questions/1578121/https-with-nsurlconnection-nsurlerrorservercertificateuntrusted). it should do your job. best luck – Dipen Panchasara May 20 '15 at 13:41
  • Could you provide a demo url? – Elf Sundae May 20 '15 at 13:42

1 Answers1

0

With reference to answer in https://stackoverflow.com/a/25213525/859001 by

@malcolmhall, I added the following lines before calling the method NSURLConnection sendAsynchronousRequest:queue:completionHandler:.

NSString *authStr = @"username:password";
NSData *authData = [authStr dataUsingEncoding:NSUTF8StringEncoding];
NSString *authValue = [NSString stringWithFormat: @"Basic %@",[authData base64EncodedStringWithOptions:0]];
[request setValue:authValue forHTTPHeaderField:@"Authorization"];

Now its working fine in production environment too (in HTTPS).

Community
  • 1
  • 1