gpt4 book ai didi

ios - swift/XCode 7 : how to temporarily set to use TSL < 1. 2

转载 作者:太空宇宙 更新时间:2023-11-03 14:10:05 24 4
gpt4 key购买 nike

等待 OS X El Capitan(以便我可以获得 TSL 1.2)我启用了我的 MAMP 服务器以使用 SSL/TSL。我的 iOS 应用程序使用如下所示的 URL,如果在浏览器中键入这些 URL 则可以正常工作:

static var webServerLoginURL = "https://localhost:443/excogitoweb/mobile/loginM.php"
static var webServerGetUserTasks = "https://localhost:443/excogitoweb/mobile/handleTasks.php"
static var webServerGetUsers = "https://localhost:443/excogitoweb/mobile/handleUsers.php"
static var webServerGetProjects = "https://localhost:443/excogitoweb/mobile/handleProjects.php"

执行:

openssl version

在终端上,我得到:

OpenSSL 1.0.2d 9 Jul 2015

所以我编辑了我的 plist 文件,添加了以下内容:

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

但是,在运行应用程序时,我仍然得到:

2015-09-21 17:54:17.491 ExcogitoWeb[83336:525096] CFNetwork SSLHandshake failed (-9824)
2015-09-21 17:54:17.497 ExcogitoWeb[83336:525096] CFNetwork SSLHandshake failed (-9824)
2015-09-21 17:54:17.500 ExcogitoWeb[83336:525096] CFNetwork SSLHandshake failed (-9824)
2015-09-21 17:54:17.500 ExcogitoWeb[83336:525096] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9824)

结果是数据库中的数据为零,应用程序崩溃。我想知道为什么它仍然拒绝工作,即使使用较低的 SSL/TSL 版本...你能帮忙吗?

最佳答案

据我所知,当您使用 NSURLSession 进行网络连接时,您只能设置协议(protocol)协商后将使用的最小/最大协议(protocol)版本,您可以在 NSURLSessionConfiguration 中设置它 属性 TLSMinimumSupportedProtocol 中的对象,可以使用属性 TLSMaximumSupportedProtocol 设置最高版本。

参见 NSURLSessionConfiguration

编辑

看来,还有一种方法可以在较低级别的 API 中限制接受的 TLS 协议(protocol)版本: iOS 5 and TLS 1.2 Interoperability Issues(虽然有点旧)

关于ios - swift/XCode 7 : how to temporarily set to use TSL < 1. 2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32699719/

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