旧 iphone 3g 上的 HTTPS 请求

发布于 2024-10-15 00:31:34 字数 469 浏览 2 评论 0原文

其他任何人在旧 iPhone 上获取 https 请求时遇到问题。

从连接确实失败并出现错误,错误消息如下。

连接错误:错误域=NSURLErrorDomain代码=-1202“该服务器的证书无效。您可能正在连接到一个冒充“www.ourwesbite.co.uk”的服务器,这可能会泄露您的机密信息信息面临风险。”

“我们的网站”有一个有效的证书,而且这个问题不会出现在任何新的 iphone/ipod touch 或 ipad 上,只是最旧的 iphone 上。

在用户单击“确定”到连接错误警报后,登录过程运行良好,从而引发连接错误,从而影响我的登录工作。但问题是它影响了登录后的UI。

所以我很想知道是否还有其他人在使用旧 iPhone 时遇到类似的问题。我的代码没有问题,因为它在模拟器和模拟器上运行得很好。 ipad/4gen iPod touch。

谢谢

Anyone else having issues with getting a https request working on the old iphone.

From connection did fail with error the error message is as follows.

ERROR with theConnection:Error Domain=NSURLErrorDomain Code=-1202 "The certificate for this server is invalid. You might be connecting to a server that is pretending to be “www.ourwesbite.co.uk” which could put your confidential information at risk."

The "ourwebsite" has a valid certificate and also this problem does not arise in any new iphone/ipod touch or ipads just the oldest iphones.

This is affecting my login from working by throwing a connection error after user clicks ok to the connection error alert the login process runs through fine. But the problem is its affecting the UI after the login.

So pretty much want to know if anyone else is having issues like this with the old iphone. There is no problem with my code as it works perfectly fine on simulator & ipad/4gen ipod touch.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

深海不蓝 2024-10-22 00:31:34

我们遇到了此错误,并且相关 iPhone 3g 的日期和时间设置不正确。这意味着所有 SSL 事务都会失败。

我们假设这个 iOS 错误是苹果的问题,而不是我们的问题,因此破解 SSL 证书以使其被忽略并不是解决方案!

We had this error and the iPhone 3g in question had an incorrect date and time set. This meant all SSL transactions would fail.

We assumed that this iOS bug is an apple problem not ours and so hacking the SSL certificate to be ignored is not the solution!

唯憾梦倾城 2024-10-22 00:31:34

好吧,即使证书有效,它也会抛出错误。因此,使用 NSURLConnection 的以下委托方法解决了这个问题。

-(void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge{

当身份验证受到质疑时,它会被调用。下面的代码允许它继续使用 https 连接。

[challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust] forAuthenticationChallenge:challenge];

然后,如果感觉不可信,则允许连接通过

Ok so even tho the certificate is valid it will throws the error. So using the following delegate method for NSURLConnection solved this problem.

-(void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge{

it gets called when there is a challenge to the authentication. The the following bit of code allow's it to continue with the https connection.

[challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust] forAuthenticationChallenge:challenge];

And then that allows the connection through if it feels it is untrusted

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文