1、 The encryption protocol is not unified
After IOS 9, the default encryption protocol is tlsv1.2. At present, some servers still use tlsv1.0. In this way, because the protocol is not unified, the application and server cannot establish a connection, and an error is reported: error domain = nsurlerrordomain code = – 1200
there are two solutions:
The first method: Modify from the application side
Right click plist file – > Open As -> Source code, add the following code:
<key>domain</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSExceptionMinimumTLSVersion</key>
<string>TLSv1.0</string>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
The second method: Modify from the server
Let the server change the encryption protocol from tlsv1.0 or tlsv1.1 to tlsv1.2
2、 The server uses the signature certificate
If the server uses a certificate that is not authenticated by a third party organization, it will report an error when using AFN to request data: nsurlsession/nsurlconnection HTTP load failed (kcfstreamerrordomainssl, – 9806)
Select one of the three certificates (such as. CRT or. PEM) on the server side and double-click to open it, which will be added to the keychain. Export the file with suffix. Cer from the keychain, and then drag it into the project. Open build phases – > Copy bunld resources checks whether the certificate has been bound. If you do not click the + sign to bind the certificate, add the security settings in the place where the data is requested
AFSecurityPolicy * securityPolicy = [AFSecurityPolicypolicyWithPinningMode:AFSSLPinningModeCertificate];
securityPolicy.allowInvalidCertificates = YES;
securityPolicy.validatesDomainName = NO;
manager.securityPolicy = securityPolicy;
When finished, run again
Similar Posts:
- Solutions to nsurlsession / nsurlconnection HTTP load failed in IOS 9
- Transport Security has blocked a cleartext HTTP [How to Solve]
- Solutions to database connection problems: “connections could not be acquired from the underlying database!”
- Nginx 400 Bad Request | The plain HTTP request was sent to HTTPS port
- [Solved] Exception in thread “main” javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
- [How to Solve] ‘dict’ object has no attribute ‘has_key’
- Failed to create webapp project with Maven in idea (without SRC and other file directory): received fatal Alert: Protocol_ Version solution
- [Solved] Uniapp packaging IOS error: Apple root certificate is not installed in the current system
- Send QQ e-mail message prompt: error in certificate certificate is not trusted
- How to Solve error: NSPOSIXErrorD omain:100