3

I am trying to fix CFNetwork SSLHandshake failed (-9806) warning. My app working well but when I run app through Xcode in device, app crashing. I've added NSAppTransportSecurity in .plist,

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSExceptionDomains</key>
  <dict>
    <key>yourserver.com</key>
    <dict>
      <!--Include to allow subdomains-->
      <key>NSIncludesSubdomains</key>
      <true/>
      <!--Include to allow insecure HTTP requests-->
      <key>NSExceptionAllowsInsecureHTTPLoads</key>
      <true/>
      <!--Include to specify minimum TLS version-->
      <key>NSExceptionMinimumTLSVersion</key>
      <string>TLSv1.1</string>
    </dict>
  </dict>
</dict>

Also Tested with different 3g/wifi's.

Need help. Thanks in advance.

Mayur Prajapati
  • 5,454
  • 7
  • 41
  • 70
Vasu V
  • 63
  • 1
  • 9
  • Is the crash related to ATS ? Please add the exception message. – A-Live Jan 22 '16 at 08:51
  • I am using AFNetworking . I think crash is due to Network issue and not related to ATS , but due to some suggestion in stack overflow i am using ATS to prevent crash in real time – Vasu V Jan 22 '16 at 09:09

2 Answers2

1

Go through this link

Also try with different versions of TLS like below.

<key>NSTemporaryExceptionMinimumTLSVersion</key> <string>TLSv1.1</string>

Also check with this by adding to your app's Info.plist:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSExceptionDomains</key>
    <dict>
        <key>YOUR_HOST.COM</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
            <true/>
            <key>NSTemporaryExceptionMinimumTLSVersion</key>
            <string>1.0</string>
            <key>NSTemporaryExceptionRequiresForwardSecrecy</key>
            <false/>
        </dict>
    </dict>
</dict>
Community
  • 1
  • 1
Satish A
  • 584
  • 4
  • 17
0

I'd the same problem. After reading this post CFNetwork SSLHandshake failed iOS 9, I put this on Info.plist and now works:

<key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>
Community
  • 1
  • 1
mabg
  • 1,894
  • 21
  • 28