Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to handle "CFNetwork SSLHandshake failed" in iOS

Some times i'm getting CFNetwork SSLHandshake failed -(9806) in my code,but i'm not sure why this is happening as my code runs smoothly,except when i run it in iOS 6 and then on iOS 7 64-bit i get this warning.
Can anybody suggest me, how to handle this issue ?

like image 570
Arun_ Avatar asked Nov 12 '13 06:11

Arun_


3 Answers

Normally when I get CFNetwork SSLHandshake failed -(*) Its because of my local wifi network (device is connected to network but not the internet)

Try it again on another network (3G is the quickest solution for me)

like image 152
JoshK Avatar answered Oct 19 '22 00:10

JoshK


This could also happen because of iOS 9. iOS 9 and OSX 10.11 require TLSv1.2 SSL for all hosts you plan to request data from unless you specify exception domains in your app's Info.plist file.

You can find more info here: https://developer.apple.com/library/prerelease/ios/technotes/App-Transport-Security-Technote/

Or Steven Peterson's answer here, which is quite clear: https://stackoverflow.com/a/30720929/1485701

like image 11
Antoine Avatar answered Oct 19 '22 00:10

Antoine


Had the same issue and after I have confirmed that the server is getting the POST the solution was this:

  • Clean the project: Product -> Clean
  • Delete your app from the iOS device/iOS Simulator and quit the Simulator
  • Compile your app and run it

In my case, simple as that.

like image 6
OhadM Avatar answered Oct 19 '22 00:10

OhadM