繁体   English   中英

使用iOS 8调用Parse.com云功能时出现SSL错误

[英]SSL Error when calling Parse.com cloud functions with iOS 8

在调用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
    }
    ...
}

正如杰克考克斯所指出的那样,Parse的TLS不能满足要求。 但是你只需要为api.parse.com域添加一个例外,而异常只需要接受安全性较低的密码。 请参阅Apple关于App Transport Security的技术说明

以下是需要添加到Info.plist

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSExceptionDomains</key>
    <dict>
        <key>api.parse.com</key>
        <dict>
            <key>NSExceptionRequiresForwardSecrecy</key>
            <false/>
        </dict>
    </dict>
</dict>

更新: Parse昨天发出一封电子邮件说他们将在2015年8月8日更新他们的证书,这应该摆脱对此的需求。 当发生这种情况时,我会更新我的答案。

看来,Analytics服务器尚不支持TLSv2。 要暂时解决此问题,您需要告诉iOS 9应用程序它应该进行不安全的连接。

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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM