Nsurlconnection / cfurlconnection HTTP load failed (kcfstreamerdomainssl, – 9813) IOS

At present, I am using a soap web service in IOS. My source code is as follows

NSString *xml = requestXMLToSent;

NSString *msgLength = [NSString stringWithFormat:@"%lu",(unsigned long)[xml length]];
NSURL *serviceURL = [NSURL URLWithString: url];
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:serviceURL];

[urlRequest addValue:@"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
[urlRequest addValue: serviceURL forHTTPHeaderField:@"SOAPAction"];
[urlRequest addValue:msgLength  forHTTPHeaderField:@"Content-Length"];
[urlRequest setHTTPBody: [xml dataUsingEncoding:NSUTF8StringEncoding]];
[urlRequest setHTTPMethod:@"POST"];

[NSURLConnection sendAsynchronousRequest:urlRequest queue:[[NSOperationQueue alloc]init] completionHandler:^(NSURLResponse *response,NSData *data,NSError *connectionError) {


    if (connectionError == NULL) {

        NSHTTPURLResponse * httpResponse = (NSHTTPURLResponse *) response;
        NSInteger statuscode = httpResponse.statusCode;
        if (statuscode == 200) {

            NSString *responseString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
            NSLog(@"response String  : %@",responseString);


        }else{
            NSLog(@"%@",response);

        }




    }else{

        NSLog(@"There is an error in URL connection and the Error is : %@",connectionError);
    }

I received the following error @ console

NSURLConnection/CFURLConnection HTTP load Failed (kcfStreamErrorDomainSSL,-9813)

URL connection error: error domain = nsurlerrordomain code = - 1202 "the certificate of this server is invalid. You may connect to" www.xxxxxxxx " Net, which may put your confidential information at risk. "Userinfo = 0x10948bbb0 {nsunderlyingerror = 0x109470d10" the certificate of this server is invalid. You may connect to a server counterfeited as "www.xxxxxx. Net", which may put your confidential information at risk. " NSErrorFailingURLStringKey = https: // www .———————————-, Nserrorfailingurlkey = HTTPS: / / –––––– nslocalizedrecoverysuggestion = do you want to connect to the server? Nsurlerrorfailingurlpeertrusterrorkey =, nslocalizeddescription = the certificate for this server is invalid You may connect to a server pretending to be "www.xxxxxx. Net", which may put your confidential information at risk

Solution

The server is throwing an SSL certificate error

The above is the full content of nsurlconnection / cfurlconnection HTTP loading failure (kcfstreamerdomainssl, - 9813) IOS collected and sorted by programming home for you. I hope this article can help you solve the program development problems encountered by nsurlconnection / cfurlconnection HTTP loading failure (kcfstreamerdomainssl, - 9813) IOS.

If you think the content of the programming home website is good, you are welcome to recommend the programming home website to programmers and friends.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>