DataWithContentsOfURL iOS HTTPS Self-signed Certificate

I am trying to load a JSON object from a page hosted on a web server using the method

[NSData dataWithContentsOfURL:[NSURL URLWithString:@"https://<url>"]]

but that will not work. The same call with the same address with http:// instead of https:// works. The server has a self-signed certificate and is not trusted by iOS (by default).

What can I do to make it trusted for my application?

+4
source share
1 answer

Do not use +dataWithContentsOfURL: for this. Use NSURLConnection directly, which gives you delegation methods for proper authentication.

+3
source

All Articles