Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I sometimes get an error on iOS 8 when calling CloudCode functions. It only happens sometimes, and I have no idea why:

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
    }
    ...
}
like image 222
Cherif Avatar asked Apr 02 '15 10:04

Cherif


1 Answers

As Jack Cox pointed out Parse's TLS isn't up to snuff. But you just need to add an exception for the api.parse.com domain, and the exception only needs to accept the less secure ciphers. See this Tech Note from Apple about App Transport Security.

Here's what needs to be added to your Info.plist:

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

UPDATE: Parse sent out an email yesterday saying they'd be updating their certs on 8/11/2015, which should get rid of the need for this. I'll update my answer when that has happened.

like image 150
aranasaurus Avatar answered Nov 02 '22 07:11

aranasaurus