Hello, I am using a NSXMLParser class in my program and I assign a delegate to it. This delegate, though, gets retained by the setDelegate: method resulting to a minor, yet annoying :-), memory leak.
I cannot release the delegate class after the setDelegate: because the program will crash.
Here is my code:
self.parserDelegate = [[ParserDelegate alloc] init]; //retainCount:1
self.xmlParser = [[NSXMLParser alloc] initWithData:self.xmlData];
[self.xmlParser setDelegate:self.parserDelegate]; //retainCount:2
[self.xmlParser parse];
[self.xmlParser release];
ParserDelegate is the delegate class.
Of course if I set 'self' as the delegate, I will have no problem but I would like to know if there is a way to use a different class as delegate with no leaks.
Thank you in advance.