Releasing Xmlparser and NSXMLParser objects
Posted
by
erastusnjuki
on Stack Overflow
See other posts from Stack Overflow
or by erastusnjuki
Published on 2011-01-15T12:35:40Z
Indexed on
2011/01/15
12:53 UTC
Read the original article
Hit count: 327
How can I release the variables xmlParser and parser safely in the function below?
- (id)callRestService: (NSString *) methodName : (NSDictionary *) params
{
NSURL *url=[self getRestUrl: methodName : params];
XmlParser *xmlParser = [[XmlParser alloc] init];
NSXMLParser *parser = [[NSXMLParser alloc] initWithContentsOfURL:url];
[parser setDelegate:xmlParser];
[parser setShouldProcessNamespaces:NO];
[parser setShouldReportNamespacePrefixes:NO];
[parser setShouldResolveExternalEntities:NO];
[parser parse];
[parser setDelegate:nil];
return xmlParser.dictionaryArray;
}
© Stack Overflow or respective owner