Reputation: 9
My app has been working correctly on previous iOS versions. I just upgraded to iOS6 and now the app is returning an error while processing an XML request/response.
The app sends an XML request to a server and receives an XML response, but now the response is empty "<>" causing the NSXMLParser to fail.
Here is how the app is sending the request (this used to work, prior ios6):
[request setURL:[NSURL URLWithString:url]];
[request setHTTPMethod:@"POST"];
[request setValue:postLength forHTTPHeaderField:@"Content-Length"];
[request setValue:@"text/xml" forHTTPHeaderField:@"Content-Type"];
//[request setValue:@"application/x-www-form-urlencoded charset=utf-8" forHTTPHeaderField:@"Content-Type"];
[request setHTTPBody:postData];
NSURLConnection *conn=[[NSURLConnection alloc] initWithRequest:request delegate:self];
if (conn)
{
receivedData = [[NSMutableData data] retain];
}
But the response is now empty "<>".
parser error is Error Domain=NSXMLParserErrorDomain Code=9 "The operation couldn’t be completed. (NSXMLParserErrorDomain error 9.)", path to file is :
/Users/ronluna/Library/Application Support/iPhone Simulator/6.0/Applications/5BA74D89-1967-4B9E-A1C0-B076F7BB9064/Documents/Menus.xml
Any ideas what could be the problem?
Upvotes: 0
Views: 436
Reputation: 31
make sure you create your NSData object with encoding specified in xml format. i.e, if xml have utf-8 encoding, the you should have : NSData* d = [xmlResponseStrings dataUsingEncoding:NSUTF8StringEncoding]; in your code, other NSUnicodexxxxx encoding will not work. Hope this help.
Upvotes: 0
Reputation: 952
Hi ive also encountered the same problem. Try changing the format of your xml file to UTF-8 without BOM or if you are populating your xml on a server side script try changing the character set to UTF-8. Hope this helps.
Upvotes: 0