ios - CFNetwork SSLHandshake failed (-9806) & (-9800) & (-9830) -


i fetching data using afnetworking(2.5). in set "setallowinvalidcertificates:yes" still getting error

cfnetwork sslhandshake failed (-9806)

cfnetwork sslhandshake failed (-9800)

cfnetwork sslhandshake failed (-9830)

nsurlconnection/cfurlconnection http load failed (kcfstreamerrordomainssl, -9830)

webclienterror: ssl error has occurred , secure connection server cannot made.

see, using code

afsecuritypolicy *policy = [afsecuritypolicy policywithpinningmode:afsslpinningmodenone];     [policy setallowinvalidcertificates:yes]; [op setcompletionblockwithsuccess:^(afhttprequestoperation *operation, id responseobject) {     nslog(@"json: %@", responseobject);     if (completion) {         completion([[umwebresponse alloc] initwithjson:responseobject]);     }  } failure:^(afhttprequestoperation *operation, nserror *error) {     if (completion) {         if (operation.responseobject) {             if (error.code == 401) {                 [appdelegate showloginviewcontroller];             }             completion([[umwebresponse alloc] initwithjson:operation.responseobject]);         } else {             if (error.code == 401) {                 [appdelegate showloginviewcontroller];             }             completion([[umwebresponse alloc] initwitherror:error]);         }     } }]; [[nsoperationqueue mainqueue] addoperation:op];  return op; 

you should edit server support tlsv1.2 , secure http requests ios 9 , osx 10.11 require tlsv1.2 ssl hosts.

but in meantime, can add exception in .plist file :

<key>nsapptransportsecurity</key> <dict>   <key>nsexceptiondomains</key>   <dict>     <key>yourserver.com</key>     <dict>       <!--include allow subdomains-->       <key>nsincludessubdomains</key>       <true/>       <!--include allow insecure http requests-->       <key>nstemporaryexceptionallowsinsecurehttploads</key>       <true/>       <!--include specify minimum tls version-->       <key>nstemporaryexceptionminimumtlsversion</key>       <string>tlsv1.1</string>     </dict>   </dict> </dict> 

if want handle every single request, add entry in .plist:

<key>nsapptransportsecurity</key> <dict>     <!--connect (this bad)-->     <key>nsallowsarbitraryloads</key>     <true/> </dict> 

source


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -