Note that there are some explanatory texts on larger screens.

plurals
  1. PONSXMLParser failed in iOS 6 with NSXMLParserNAMERequiredError
    text
    copied!<p>I am facing parsing failed issue in iOS 6 only. The code is working previous versions of iOS 6 ,but not working in iOS 6. I am trying to send login request to server url. I am getting the response from server in xml format. I am using NSXMLParser to parse the response. I am able to parse the xml in iOS 3.x, iOS 4.x and iOS 5.x but parsing is failed in iOS 6.</p> <p>I am using these lines</p> <pre><code>NSXMLParser *m_parser = [[NSXMLParser alloc] initWithData:urlData]; [m_parser setDelegate:self]; BOOL parseFlag = [m_parser parse];//parsing failed in iOS 6 </code></pre> <p>In iOS 6 only <code>- (void)parser:(NSXMLParser *)parser parseErrorOccurred:(NSError *)parseError</code> is called.</p> <p>The error I am getting is NSXMLParserErrorDomain error 68.</p> <p>Detailed source code is as below.</p> <pre><code>-(IBAction)loginButtonPressed:(id)sender { NSMutableString *urlString = [[@"someURL" mutableCopy] autorelease]; [urlString appendString:@"loginAuthenticate"]; [urlString appendFormat:@"?username=%@",m_username.text]; [urlString appendFormat:@"&amp;password=%@",pwd]; NSURL *url = [NSURL URLWithString:[urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; NSString *postLength = [NSString stringWithFormat:@"%d", [urlString length]]; NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease]; [request setURL:url]; [request setHTTPMethod:@"POST"]; [request setValue:postLength forHTTPHeaderField:@"Content-Length"]; [request setValue:@"text/xml; charset=utf-16" forHTTPHeaderField:@"Content-Type"]; [request setHTTPBody:[urlString dataUsingEncoding:NSUTF16StringEncoding]]; NSError *error; NSURLResponse *response; NSData *urlData; urlData=[NSURLConnection sendSynchronousRequest:request returningResponse:&amp;response error:&amp;error]; NSString *responseXml = [[NSString alloc] initWithData:urlData encoding:NSUTF16StringEncoding]; if (responseXml &amp;&amp;[responseXml length]&gt;0) { NSXMLParser *m_parser = [[NSXMLParser alloc] initWithData:urlData]; [m_parser setDelegate:self]; NSLog(@"urlData:%@",m_parser); BOOL parseFlag = [m_parser parse];//parsing failed in iOS 6 if (parseFlag == 1) NSLog(@"parseFlag = YES");//called if iOS version is less than iOS 6 else { NSLog(@"parseFlag = NO");//called if iOS version is iOS 6 } . . } // This delegate method is called in iOS 6 only - (void)parser:(NSXMLParser *)parser parseErrorOccurred:(NSError *)parseError { NSLog(@"%@",@"parseErrorOccured"); NSLog(@"parseError:%@",parseError); //error is NSXMLParserErrorDomain error 68 } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload