Releasing Xmlparser and NSXMLParser objects
- by erastusnjuki
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;
}