0
-(void)connectionDidFinishLoading:(NSURLConnection *)connection
{
    NSLog(@"3 DONE. Received Bytes: %d", [getMagaListsWebData length]);
    NSString *recievedXML = [[NSString alloc]initWithData:getMagaListsWebData encoding:NSUTF8StringEncoding];

    [recievedXML release];
    //重新加載xmlParser
    if(getMagaListsXmlParser){
        [getMagaListsXmlParser release];
        getMagaListsXmlParser = nil;
    }
    getMagaListsXmlParser = [[NSXMLParser alloc]initWithData:getMagaListsWebData];
    [getMagaListsXmlParser setDelegate: self];
    [getMagaListsXmlParser setShouldResolveExternalEntities: YES];
    [getMagaListsXmlParser parse];
    if (![getMagaListsXmlParser parse]) {
        NSLog(@"parse error = %@", [getMagaListsXmlParser parserError]);
        //theConnection = [[NSURLConnection alloc] initWithRequest:getMagaListsRequest delegate:self startImmediately:YES];
    }
}

我收到错误消息:

parse error = Error Domain=NSXMLParserErrorDomain
  Code=5 "The operation couldn’t be completed. (NSXMLParserErrorDomain error 5.)"
4

1 回答 1

2

一个非常有用的技巧是聚焦有问题的错误/域

NSXMLParser.h, NSXMLParserPrematureDocumentEndError = 5,

似乎您的入站文档有问题,可能是某个地方的不平衡块。

于 2012-08-05T13:39:13.660 回答