我究竟做错了什么?我无法让 xmlparser 停止解析。我设置了一个断点[xmlParser abortParsing];
,它开始运行。但if(success)
这里的一切都是我的代码:
-(void)viewDidLoad{
[NSThread detachNewThreadSelector:@selector(loadstuff)toTarget:self withObject:nil];
}
-(void)loadstuff{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
xmlParser = [[NSXMLParser alloc] initWithContentsOfURL:url];
XMLParserdelegate *parserdeleagte = [[XMLParserdelegate alloc] init];
[xmlParser setDelegate:parserdelegate];
BOOL success = [xmlParser parse];
if(success){
NSLog(@"No Errors");
links = [[NSMutableArray alloc] initWithArray:links];
titles = [[NSMutableArray alloc] initWithArray:titles];
dates = [[NSMutableArray alloc] initWithArray:dates];
descriptions = [[NSMutableArray alloc] initWithArray:descriptions];
loading = FALSE;
[theTableView reloadData];
}else{
NSLog(@"Error parsing xml");
}
[pool release];
}
-(void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
[xmlParser abortParsing];
[xmlParser release];
xmlParser = nil;
}