Search code examples
iosxcodensurlconnectionnsxmlparsergrand-central-dispatch

iOS: NSXMLParserErrorDomain Error 4, 5 & 73


In my application I have a UISearchBar, which parses the results in real-time with NSURLConnection, GCD and NSXMLParser. Everything works fine in WiFi and 3G but in EDGE I get the errors described in the title.

The parser starts right after the connection didReceiveData. Any idea?


Solution

  • You should start the parsing when connectionDidFinishLoading: is fired. In didReceiveData just concatenate the received data. See the documentation: https://developer.apple.com/library/mac/#documentation/Foundation/Reference/NSURLConnectionDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intf/NSURLConnectionDelegate