Set the certification to the NSHTTPURLResponse in iPhone
I would like to send some information to a 'HTTPS' server and get the cookies and html code from the server. I have already complete the cookies and the html part. However, when I use the开发者_Python百科 'GET' method to set the url and use the statusCode to see the http status code, I found that the status code is 0. I found the error is about the 'untrust server certificate'.
How can I add the certificate to the NSHTTPURLResponse in order to receive the 200 or 302 status code? The error display the Error Code = -1202. Thank you.
I had the same problem a few days ago, the following post solved it. Adding an untrusted certificate is (at least in the simulator) not possible, but you can tell your NSURLConnection Delegate to accept self signed certificates (or generally untrusted ones)
How to use NSURLConnection to connect with SSL for an untrusted cert?
hope I could help!
精彩评论