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

Che*_*rif 6 ssl ios 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 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
    }
    ...
}
Run Code Online (Sandbox Code Playgroud)

Jac*_*Cox 0

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

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

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSAllowsArbitraryLoads</key>
  <true/>
</dict>
Run Code Online (Sandbox Code Playgroud)