Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用iOS 8调用Parse.com云函数时出现SSL错误_Ios_Ssl_Parse Platform - Fatal编程技术网

使用iOS 8调用Parse.com云函数时出现SSL错误

使用iOS 8调用Parse.com云函数时出现SSL错误,ios,ssl,parse-platform,Ios,Ssl,Parse Platform,在调用CloudCode函数时,我有时会在iOS 8上出错。这只是偶尔发生,我不知道为什么: Error: Error Domain=Parse Code=100 "The operation couldn’t be completed. (Parse error 100.)" UserInfo=0x17ed2150 { Code=100, error=Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occu

在调用CloudCode函数时,我有时会在iOS 8上出错。这只是偶尔发生,我不知道为什么:

Error: Error Domain=Parse Code=100 "The operation couldn’t be completed. (Parse error 100.)" UserInfo=0x17ed2150 

{   Code=100, 
    error=Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made."
    UserInfo=0x19d0c750 {
        NSLocalizedDescription=An SSL error has occurred and a secure connection to the server cannot be made.,
        NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, 
        _kCFStreamErrorCodeKey=-9824, 
        NSErrorFailingURLStringKey=https://api.parse.com/1/functions/weshread,
        _kCFStreamErrorDomainKey=3, 
        NSUnderlyingError=0x19de4f40 "An SSL error has occurred and a secure connection to the server cannot be made.", 
        NSErrorFailingURLKey=https://api.parse.com/1/functions/weshread
    }
    ...
}

分析服务器似乎还不支持TLSv2。为了暂时解决这个问题,你需要告诉iOS 9应用程序它应该进行不安全的连接

将以下条目添加到应用程序的info.plist文件中:

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

正如杰克·考克斯(Jack Cox)指出的那样,Parse的TLS没有达到标准。但是您只需要为
api.parse.com
域添加一个异常,该异常只需要接受不太安全的密码。请参阅苹果关于应用程序传输安全的文章

以下是需要添加到您的
Info.plist

NSAppTransportSecurity
NSExceptionDomains
api.parse.com
NSExceptionRequiresForwardSecretary

更新:Parse昨天发送了一封电子邮件,说他们将在2015年11月8日更新证书,这应该可以消除这种需要。发生这种情况时,我将更新我的答案。

Ack!这将禁用所有ATS。您所需要做的就是为“api.parse.com”添加一个异常,其中NSExceptionRequiresForwardSecretary设置为false。同意,这是一个快速而肮脏的解决方法。最好的选择是游说Parse让TLSv2在他们的API上工作;在尝试联系Parse.com时,我仍然会遇到SSL错误。我们如何使用Alamofire处理此异常?我已尝试了您的解决方案,但仍收到异常。(附注:使用iOS9)