[英]NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813) in iOS 9 with Xcode 7.1
I am using iOS 9 as target & using Xcode 7.1, tried everything as my level best for all the solutions of ATS but didn't work. 我使用iOS 9作为目标并使用Xcode 7.1,尝试将所有内容作为我所有ATS解决方案的最佳级别,但是没有用。 Below is the following error description coming at console.
以下是控制台上的以下错误说明。 If any suggestion comes I will be obliged.
如果有任何建议,我将被迫。
Some of the key things here are - 这里的一些关键事项是 -
NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813)
Error excluding Main.db from backup Error Domain=NSCocoaErrorDomain Code=4 "The file “Main.db” doesn’t exist." UserInfo={NSURL=file:///Users/Raj/Library/Developer/CoreSimulator/Devices/BC3A0589-3B9A-4AFD-8F2A-B1C92FA341DD/data/Containers/Data/Application/70B3043A-8553-41E5-A147-8508D08BF3E6/Documents/Main.db, NSFilePath=/Users/Raj/Library/Developer/CoreSimulator/Devices/BC3A0589-3B9A-4AFD-8F2A-B1C92FA341DD/data/Containers/Data/Application/70B3043A-8553-41E5-A147-8508D08BF3E6/Documents/Main.db, NSUnderlyingError=0x798465c0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}
2016-08-30 21:09:10.867 GFIM[80653:484899] SFOAuthCredentials:revokeRefreshToken: refresh token revoked. Cleared identityUrl, instanceUrl, issuedAt fields
2016-08-30 21:09:10.871 GFIM[80653:484899] INFO|0|SFPasscodeManager|Resetting passcode upon logout.
SFOAuthCredentials:revokeRefreshToken: refresh token revoked. Cleared identityUrl, instanceUrl, issuedAt fields
These are the things might be the cause of issue. 这些可能是问题的原因。
2016-08-30 21:09:19.095 GFIM[80653:484899] SFOAuthCoordinator:webViewDidStartLoad: host=test.salesforce.com : path=/
2016-08-30 21:09:19.863 GFIM[80653:484962] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813)
2016-08-30 21:09:19.983 GFIM[80653:484962] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813)
2016-08-30 21:09:20.016 GFIM[80653:484962] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813)
2016-08-30 21:09:20.054 GFIM[80653:484962] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813)
2016-08-30 21:09:20.194 GFIM[80653:484962] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813)
2016-08-30 21:09:20.956 GFIM[80653:484962] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813)
2016-08-30 21:09:38.285 GFIM[80653:484899] SFOAuthCoordinator:webView:shouldStartLoadWithRequest: (navType=1): host=test.salesforce.com : path=/
2016-08-30 21:09:38.311 GFIM[80653:484899] SFOAuthCoordinator:webViewDidStartLoad: host=test.salesforce.com : path=/
2016-08-30 21:09:38.834 GFIM[80653:484899] SFOAuthCoordinator:webView:shouldStartLoadWithRequest: (navType=1): host=5-prod--stg.cs30.my.salesforce.com : path=/secur/frontdoor.jsp
If you try to make HTTP requests with ATS enabled (using NSURLSession or libraries like AFNetworking), you'll see errors like this. 如果您尝试在启用ATS的情况下发出HTTP请求(使用NSURLSession或像AFNetworking这样的库),您将看到这样的错误。
Here's how to disable ATS entirely. 以下是完全禁用ATS的方法。 Open Info.plist, and add the following lines:
打开Info.plist,并添加以下行:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
Your info.plist file should look like this 您的info.plist文件应如下所示
See this post: https://stackoverflow.com/a/31077483/6763322 请看这篇文章: https : //stackoverflow.com/a/31077483/6763322
From iOS 9 Onwards Apple Enforce To make HTTP Request with Specific Host for Security Purpose. 从iOS 9开始Apple强制使用特定主机发出HTTP请求以实现安全目的。 //Also works on iOS 10 with Swift 3
//也可以在iOS 10上使用Swift 3
For that, you need to Add NSAppTransportSecurity
Dictionary into your .plist
the file of Project. 为此,您需要将
NSAppTransportSecurity
Dictionary添加到.plist
中的Project文件中。 Then your plist
will look something like this as follows. 然后你的
plist
看起来如下所示。
Tap to see .Plist File Image 点按即可查看.Plist文件图片
Here NSAllowArbitraryLoads
basically means Connect to anything (this is probably BAD). 这里
NSAllowArbitraryLoads
基本上意味着连接到任何东西(这可能是坏的)。 Instead of this you can add a particular Host to be Connect. 您可以添加特定主机进行连接,而不是此操作。
我只是在设备中运行而不是模拟器。它开始工作了
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.