ios - I set "Allow Arbitrary Loads" with "YES" , But getting HTTP load failed (kCFStreamErrorDomainSSL, -9806) -
i have following setting in project info.plist:
<key>nsapptransportsecurity</key> <dict> <key>nsallowsarbitraryloads</key> <true/> </dict>
but still getting following error vodafone mobile data:
nsurlsession/nsurlconnection http load failed (kcfstreamerrordomainssl, -9806) error details: error domain=nsurlerrordomain code=-1200 "an ssl error has occurred , secure connection server cannot made." userinfo={_kcfstreamerrorcodekey=-9806, nslocalizedrecoverysuggestion=would connect server anyway?, nsunderlyingerror=0x17004dfb0 {error domain=kcferrordomaincfnetwork code=-1200 "(null)" userinfo={_kcfstreampropertysslclientcertificatestate=0, _kcfnetworkcfstreamsslerrororiginalvalue=-9806, _kcfstreamerrordomainkey=3, _kcfstreamerrorcodekey=-9806}}, nslocalizeddescription=an ssl error has occurred , secure connection server cannot made., nserrorfailingurlkey=https://v1.xyz.net:8080/signup/, nserrorfailingurlstringkey=https://v1.xyz.net:8080/signup/, _kcfstreamerrordomainkey=3}
updated here code :
nsstring *jsonrequest=@"json"; nsurl *baseurl = [nsurl urlwithstring:@"https://v1.xyz.net:8080/signup/"]; nsurlsessionconfiguration *configuration = [nsurlsessionconfiguration defaultsessionconfiguration]; configuration.requestcachepolicy=nsurlrequestreloadignoringlocalcachedata; nsurlsession *session = [nsurlsession sessionwithconfiguration:configuration]; nsmutableurlrequest *request = [[nsmutableurlrequest alloc] init]; [request sethttpmethod:@"post"]; [request addvalue:@"application/json" forhttpheaderfield:@"content-type"]; [request addvalue:@"application/json" forhttpheaderfield:@"accept"]; nsdata *postdata = [nsjsonserialization jsonobjectwithdata:[jsonrequest datausingencoding:nsutf8stringencoding] options:0 error:nil]; [request seturl:baseurl]; [request sethttpbody:postdata]; nsurlsessiondatatask *postdatatask = [session datataskwithrequest:request completionhandler:^(nsdata *data, nsurlresponse *response, nserror *error) { if (!error) { nsdictionary *responseobject = [nsjsonserialization jsonobjectwithdata:data options:0 error:nil]; nslog(@"%@",responseobject); } else { // error code here nslog(@"error %@",error); } }]; [postdatatask resume];
the issue mobile operator blocked https on port 8080, changed port use standard https port 443 , works well.
we used following steps investigate issue:
1- checking our server certificate: $openssl s_client -connect https://v1.xyz.net:8080/signup/
2- using nscurl tool diagnose ats connection issues: /usr/bin/nscurl --ats-diagnostics --verbose https://v1.xyz.net:8080/signup/
Comments
Post a Comment