У меня странная проблема с моим приложением.
Когда я открываю свое приложение, оно анализирует RSS-канал и отображает результаты в виде таблицы, и нет никаких утечек, НО, если я нажимаю кнопку обновления, оно протекает (много): (
Мой проект: Ссылка
Код:
viewDidLoad
UIBarButtonItem *ShareButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(tableView_ReFresh)];
self.navigationItem.rightBarButtonItem = ShareButton;
[ShareButton release];
viewDidAppear
if ([stories count] == 0) {
NSURL *path = [[NSURL alloc] initWithString:@"http://feeds.feedburner.com/TheAppleBlog"];
[self parseXMLFileAtURL:path];
[path release];
}
tableView_ReFresh
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSURL *path = [[NSURL alloc] initWithString:@"http://feeds.feedburner.com/TheAppleBlog"];
[self parseXMLFileAtURL:path];
[self.tableView performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO];
[path release];
[pool drain];
reloadData
[blogTable reloadData];
parseXMLFileAtURL
stories = [[NSMutableArray alloc]init];
[[NSURLCache sharedURLCache] setMemoryCapacity:0];
[[NSURLCache sharedURLCache] setDiskCapacity:0];
NSData *xml = [NSData dataWithContentsOfURL:URL];
rssParser = [[NSXMLParser alloc] initWithData:xml];
[rssParser setDelegate:self];
// Depending on the XML document you're parsing, you may want to enable these features of NSXMLParser.
[rssParser setShouldProcessNamespaces:NO];
[rssParser setShouldReportNamespacePrefixes:NO];
[rssParser setShouldResolveExternalEntities:NO];
[rssParser setDelegate:self];
[self.view setNeedsDisplay];
[rssParser parse];
[xml release];
didStartElement
currentElement = [[elementName copy]autorelease];
if ([elementName isEqualToString:@"item"]) {
// clear out our story item caches...
item = [[[NSMutableDictionary alloc] init]autorelease];
currentTitle = [[NSMutableString alloc] init];
currentDate = [[NSMutableString alloc] init];
currentContent = [[NSMutableString alloc] init];
currentPostID = [[NSMutableString alloc] init];
currentCommentLink = [[NSMutableString alloc] init];
currentCommentNum = [[NSMutableString alloc] init];
}
didEndElement
if ([elementName isEqualToString:@"item"]) {
// save values to an item, then store that item into the array...
[item setObject:currentTitle forKey:@"title"];
[item setObject:currentPostID forKey:@"link"];
[item setObject:currentContent forKey:@"Content"];
[item setObject:currentDate forKey:@"date"];
[item setObject:currentCommentLink forKey:@"commentRssLink"];
[item setObject:currentCommentNum forKey:@"commentsNum"];
[stories addObject:[item copy]];
NSLog(@"adding story: %@", currentPostID);
//NSLog(@"adding story: %@", currentContent);
}
foundCharacters
if ([currentElement isEqualToString:@"title"]) {
[currentTitle appendString:string];
} else if ([currentElement isEqualToString:@"guid"]) {
[currentPostID appendString:string];
} else if ([currentElement isEqualToString:@"content:encoded"]) {
[currentContent appendString:string];
} else if ([currentElement isEqualToString:@"pubDate"]) {
[currentDate appendString:string];
} else if ([currentElement isEqualToString:@"wfw:commentRss"]) {
[currentCommentLink appendString:string];
} else if ([currentElement isEqualToString:@"slash:comments"]) {
[currentCommentNum appendString:string];
}
parserDidEndDocument
[blogTable reloadData];
dealloc
[super dealloc];
[currentElement release];
[rssParser release];
[stories release];
[item release];
[currentTitle release];
[currentDate release];
[currentContent release];
[currentPostID release];
[currentCommentLink release];
[currentCommentNum release];
Как мне это исправить?
Спасибо