iOS10 NSURLErrorDomain Code 1200
生活随笔
收集整理的這篇文章主要介紹了
iOS10 NSURLErrorDomain Code 1200
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
為什么80%的碼農(nóng)都做不了架構(gòu)師?>>> ??
環(huán)境 xCode8 iOS10 操作:新浪微博的第三方登錄
一、異常信息
error = Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made." UserInfo={_kCFStreamErrorCodeKey=-9824, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?發(fā)生了 SSL 錯(cuò)誤,無(wú)法建立與該服務(wù)器的安全連接
二、網(wǎng)上解決方案
在info.plist 中添加以下代碼,但沒(méi)有解決問(wèn)題
<key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> </true> </dict>三、解決過(guò)程
3.1 驗(yàn)證服務(wù)器ATS是否PASS
nscurl --ats-diagnostics --verbose https://xxx.com 出現(xiàn)問(wèn)題的URL,在服務(wù)端上配置TLSV1.2
? nscurl --ats-diagnostics --verbose https://api.xxx.com/oauth2/authorize\?client_id\=xxxxxx\&redirect_uri\=http://www.xxx.com/data/api/oauth/connect.php\?method\=weibo_callback\&response_type\=code\&state\=weibo_58247803463a94.25994144 Starting ATS DiagnosticsConfiguring ATS Info.plist keys and displaying the result of HTTPS loads to https://api.weibo.com/oauth2/authorize?client_id=1681325651&redirect_uri=http://www.guojishitiao.com/data/api/oauth/connect.php?method=weibo_callback&response_type=code&state=weibo_58247803463a94.25994144. A test will "PASS" if URLSession:task:didCompleteWithError: returns a nil error. ================================================================================Default ATS Secure Connection --- ATS Default Connection ATS Dictionary: { } 2016-11-10 21:50:17.832 nscurl[37466:1493984] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9801) Result : FAIL <--問(wèn)題》》 在服務(wù)端 Nginx上配置TLSV1.2,支持ATS四、另外
*** 由于iOS10的發(fā)布,原有ATS設(shè)置在iOS10上會(huì)出現(xiàn)https網(wǎng)絡(luò)訪(fǎng)問(wèn)限制的問(wèn)題。***
<key>sina.com.cn</key> <dict><key>NSIncludesSubdomains</key><true/><key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key><true/><key>NSExceptionMinimumTLSVersion</key><string>TLSv1.0</string><key>NSThirdPartyExceptionRequiresForwardSecrecy</key><false/> </dict>需要在問(wèn)題域名下添加NSExceptionMinimumTLSVersion 的key,值設(shè)置為T(mén)LSv1.0
參考: https://github.com/sinaweibosdk/weibo_ios_sdk
==
轉(zhuǎn)載于:https://my.oschina.net/wolx/blog/785909
總結(jié)
以上是生活随笔為你收集整理的iOS10 NSURLErrorDomain Code 1200的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: MariaDB 加密特性及使用方法
- 下一篇: 【uva 1617】Laptop(算法效