[英]iOS & Parse.com: How to set User when calling Parse Cloud Code?
[英]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.