iOS9 getting error “an SSL error has occurred and a secure connection to the server cannot be made”
For the iOS9, Apple made a radical decision with iOS 9, disabling all unsecured HTTP traffic from iOS apps, as a part of App Transport Security (ATS).
To simply disable ATS, you can follow this steps by open Info.plist, and add the following lines:
NSAppTransportSecurity
NSAllowsArbitraryLoads
iOS 9.3 : An SSL error has occurred and a secure connection to the server cannot be made
At the command-line in OS X, run the following:
nscurl --ats-diagnostics https://filename.hostname.net --verbose
This will tell you what combinations of ATS settings will and will not permit iOS to access your site, and should point you towards what is wrong with your site.
It could be one or more of the following
- Certificate hash algorithm (must be SHA-256 or above)
- TLS version (must be 1.2)
- TLS algorithms (must provide Perfect Forward Secrecy)
“an ssl error has occurred and a secure connection to the server cannot be made” connecting to Internal Development Server on phone only
After I read this document from Apple
NSAppTransportSecurity
NSExceptionDomains
Your Domain
NSIncludesSubdomains
NSThirdPartyExceptionRequiresForwardSecrecy
My app is now working on devices. My cert on the server is not Forward Secrecy ready yet.
iOS 11 : SSL error occurred and connection to server cannot be made
Judging by the screenshot, it appears you might be using a .dev domain. If so, you will not be able to disable ATS because Google owns the .dev domain, and they have chosen to require all .dev domains require HTTPS. In iOS 11, Apple supports HSTS preloading, which allows certain domains to be restricted to secure connection only. The .dev top-level domain (TLD) is now one of those TLDs that require HTTPS. See more about that here: https://stackoverflow.com/a/47698675/3708242
You screenshot includes an ATS exception that ends in .dev, but your comments specify a different domain. I'm assuming that maybe there are multiple exceptions in your Info.plist, and you use the .dev for internal testing against a local server. If that is the case, simply change the domain for your internal testing to something other than *.dev
. Also, not that the exception in your screenshot is not correct, as it includes http:// in the exception domain. Instead of an entry in the InfoPlist like "http://mylocalserver.local", you should just have "mylocalserver.local" (no http://).
If your entry for abc.pqr.lmn
is the same (it also includes the protocol in the exception domain), remove the "http://" and it should work.
Also, your exceptions list is a bit of a mess. If you are not using https at all, you should be able to remove all the entries except for NSExceptionAllowsInsecureLoads
. All the other settings you specify are for if you want to allow for HTTPS connections that don't support the minimum requirements for ATS. If you are just trying to non-secure HTTP traffic, get rid of the others.
So in summary:
- Don't use a .dev domain for local testing, as Google owns the top-level domain now and requires all new browsers / OSs to use HTTPS when connecting to anything that ends in .dev.
- Don't include "http://" in your ATS exception domains in your Info.plist
- It doesn't have anything to do with it being in Objective-C - it has to do with iOS 11 implementing HSTS preloading.
System.Net.WebException: An SSL error has occurred and a secure connection to the server cannot be made
Cause: Since iOS 9, iOS will only allow your application to communicate with servers that implement best-practice security by default. Values must be set in Info.plist to enable communication with insecure servers.It seems that you only AllowInsecureHTTPSLoads
but forget to add AllowsInsecureHTTPLoads
Solution: Add the following code in your info.plist to trust your domain.
NSAppTransportSecurity
NSExceptionDomains
pm-admin.smartwcm.com
NSExceptionRequiresForwardSecrecy
NSExceptionAllowsInsecureHTTPLoads
NSIncludesSubdomains
......
Here is a similar issue that you can refer.
Mobilelfirst 7.1 - ios9 An SSL error has occurred and a secure connection to the server cannot be made
Make sure that you have properly configured the MobileFirst Server with TLS 1.2 support by following the instructions provided in this blog post (too long to post as an answer): https://mobilefirstplatform.ibmcloud.com/blog/2015/09/07/preparing-ibm-mobilefirst-platform-server-app-transport-security-ios-9/
Related Topics
How to Detect Orientation Change
How to Turn Page Programmatically in Uipageviewcontroller
How to Programmatically Sense the Iphone Mute Switch
Do Something Every X Minutes in Swift
When to Use Dequeuereusablecellwithidentifier VS Dequeuereusablecellwithidentifier: Forindexpath
Ios 6: How to Restrict Some Views to Portrait and Allow Others to Rotate
Warning :-Presenting View Controllers on Detached View Controllers Is Discouraged
Uitapgesturerecognizer Breaks Uitableview Didselectrowatindexpath
How to Load Local HTML File into Uiwebview
A Swift Example of Custom Views For Data Input (Custom In-App Keyboard)
How to Parse Json Response from Alamofire API in Swift
Changing Tint/Background Color of Uitabbar
Sending Data With Segue With Swift