gpt4 book ai didi

ios - 如何在 iOS 9 中加载 HTTPS URL?

转载 作者:可可西里 更新时间:2023-11-01 04:00:21 27 4
gpt4 key购买 nike

我需要在我的 info.plist 中添加什么设置才能启用 HTTPS 模式?我已经把它放在我的 plist 中了:

<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>

但它不起作用,我仍然收到此错误

Error Message:-

2016-02-25 12:46:31.860 Indus Audio[707:13224] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813)

2016-02-25 14:20:31.119 Indus Audio[817:23670] Response:(null) 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.indusaudio.com” which could put your confidential information at risk."

UserInfo={NSURLErrorFailingURLPeerTrustErrorKey=, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFStreamErrorDomainKey=3, _kCFStreamErrorCodeKey=-9813, NSErrorPeerCertificateChainKey={type = immutable, count = 1, values = ( 0 : )}, NSUnderlyingError=0x7f9e58e05cf0 {Error Domain=kCFErrorDomainCFNetwork Code=-1202 "(null)" UserInfo={_kCFStreamPropertySSLClientCertificateState=0, kCFStreamPropertySSLPeerTrust=, _kCFNetworkCFStreamSSLErrorOriginalValue=-9813, _kCFStreamErrorDomainKey=3, _kCFStreamErrorCodeKey=-9813, kCFStreamPropertySSLPeerCertificates={type = immutable, count = 1, values = ( 0 : )}}},

网址:https://www.xxxxx.com/xxx/xxx/files/downloadFile/en/linto

最佳答案

更新:更好地更新您的服务器以支持 SSL 和 TLSv1.2

仅将其用于临时用途。这种方法并不完全可取:

   <key>NSAppTransportSecurity</key>
<dict>
<!--Connect to anything. Not advisable. For desperate measures I guess-->
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>

原答案:

iOS 9 支持 TLSv1.2,参见 this document .因此,通过将其更改为 TLSv1.1,它绕过了安全性(这并不是完全可取的)。另外,像这样指定您的 url:

 <key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>enterYourUrlHere.com</key>
<dict>
<!--Include to allow subdomains-->
<key>NSIncludesSubdomains</key>
<true/>
<!--Include to allow HTTP requests-->
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
<!--Include to specify minimum TLS version-->
<key>NSTemporaryExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
</dict>
</dict>
</dict>

关于ios - 如何在 iOS 9 中加载 HTTPS URL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35622197/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com