Search code examples
iosswiftxcodeadmobapp-transport-security

Xcode error: NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9814)


I'm currently developing a game that requires ATS to be disabled:

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

(In the code above there are no exception domains)

I need this because I'm using AdMob rewarded video mediation with Vungle and AdColony - both require ATS to be disabled. I realize that I could modify that code to make these sites exceptions while ATS is enabled, but it didn't seem to change anything, except give me warnings in the console from the ad networks telling me that ATS needs to be enabled.

The ads used to work fine with ATS disabled and didn't receive this warning until I updated to Xcode 8 (I was using Swift 3 and Xcode 8 beta before).

Even though I disable ATS, these ad networks don't seem to work (I also setup a third ad network that doesn't require disabling ATS to check if it was an AdMob problem, and it worked fine).

Whenever it tries to load a video ad I get this warning in the console multiple times:

NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9814)

I'm not sure what I should do about this. I've read practically every other similar answer to this type of issue, but none seem to fix the problem. Also, since I'm not using my own server, I can't/dont know how to make the desired ad networks sites whitelisted (I've tried putting in their domains/subdomains as exceptions)

Is there something important that I'm missing or is what I'm doing completely wrong? Is there a solution to this or do I have to wait for the ad networks to become ATS compliant? Any help is appreciated.

PS: I know about how all apps should be ATS compliant and could/likely will get denied from the app store...


Solution

  • It seems that it was just a bug. After updating AdMob, Xcode, macOS, and iOS to the latest versions and restarting Xcode and the computer, the problem seemed to have disappeared. Now everything works fine including the ads and no warning is shown in the console. I'm guessing that it was a bug with Xcode and not any of the other things I updated.