gpt4 book ai didi

ios - 解析器错误 Error Domain=NSXMLParserErrorDomain Code=4 "The operation couldn’ t be completed."

转载 作者:可可西里 更新时间:2023-11-01 04:24:04 27 4
gpt4 key购买 nike

我正在调用一个网络服务,如下所示:

-(void)verifyEmailAndPasswordWebservices
{
NSString *MD5Password = [ self MD5];
NSLog(@"text field password %@",txt_Password.text);
NSLog(@"converted password %@",MD5Password);

NSString *soapMsg =[NSString stringWithFormat:
@"<?xml version=\"1.0\" encoding=\"utf-8\"?>"
"<SOAP-ENV:Envelope SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:tns=\"http://php:8393/includes/webservice\">"
"<SOAP-ENV:Body>"
"<ns1:LoginUserRequest xmlns:ns1=\"http://schemas.xmlsoap.org/soap/envelope/\">"
"<email xsi:type=\"xsd:string\">%@</email>"
"<pass xsi:type=\"xsd:string\">%@</pass>"
"</ns1:LoginUserRequest>"
"</SOAP-ENV:Body>"
"</SOAP-ENV:Envelope>",txt_EmailOrMobile.text,MD5Password];



//---print it to the Debugger Console for verification---
NSLog(@"soapMsg..........%@",soapMsg);

NSURL *url = [NSURL URLWithString:@"http://10.0.0.115:8393/includes/webservice/login1.php"];
req = [NSMutableURLRequest requestWithURL:url];

//---set the headers---

NSString *msgLength = [NSString stringWithFormat:@"%d",[soapMsg length]];
[req addValue:@"application/soap+xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
[req addValue:@"http://10.0.0.115/includes/webservice/login1.php/LoginUser" forHTTPHeaderField:@"SoapAction"];
[req addValue:msgLength forHTTPHeaderField:@"Content-Length"];

//---set the HTTP method and body---

[req setHTTPMethod:@"POST"];
[req setHTTPBody: [soapMsg dataUsingEncoding:NSUTF8StringEncoding]];

// [activityIndicator startAnimating];

conn = [[NSURLConnection alloc] initWithRequest:req delegate:self];
if (conn)
{
webData = [[NSMutableData data] retain];
}
}

当我收到回复时,出现以下错误:

完成。接收字节数:422显示 XML(空)解析器错误 Error Domain=NSXMLParserErrorDomain Code=4 “操作无法完成。(NSXMLParserErrorDomain 错误 4.)”

我在互联网上搜索了很多。但找不到任何东西。请提供任何帮助。

最佳答案

NSXMLParserErrorDomain error 4 意味着 XML 解析器得到了一个空文档。这向我表明输入要么为 null,要么您在将其提供给解析器之前设法更改了它。

我仔细看了你的代码。问题不在于你没有得到回应。只是你没有等待它。您发送的请求是异步的,但您正试图立即(即同步)填充您的 webData 变量。

关于ios - 解析器错误 Error Domain=NSXMLParserErrorDomain Code=4 "The operation couldn’ t be completed.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7304850/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com