开发者

iOS HTTPS possible communication problem

My server certificate开发者_JS百科 expired a couple of days ago and my app (which communicates with the server over HTTPS) crashes now (unable to connect). It is a simple synchronous post https call. The program is never run on the server. The access is never logged in the Apache log. This leads me to believe that the expired certificate is the problem. Nothing in the code on the server or the app has changed in 3 weeks.

Is there a way to set a flag that says that the certificate doesn't have to valid in order to make the connection?


You can do it in a non-private API manner if you're using ASIHTTPRequest.

   NSURL *url = [NSURL URLWithString:@"https://www.google.com"];
   ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url]

[request setValidatesSecureCertificate:NO];

Or see this answer (using NSURLConnection delegate)

HTTPS with NSURLConnection - NSURLErrorServerCertificateUntrusted

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜