2012-01-09 99 views
0

一個application.In該應用程序IAM工作,我宣佈viewDidLoad中的的NSXMLParser對象method.But哪裏這個對象可以release.So請告訴我這是發行版object.See我的代碼中的正確位置如何釋放NSXmlParser對象?

NSString *xmlFilePath = [[NSBundle mainBundle] pathForResource:@"file" ofType:@"xml"]; 
NSData *data=[NSData dataWithContentsOfFile:xmlFilePath]; 
NSXMLParser *xmlParser = [[NSXMLParser alloc] initWithData:data]; 
[xmlParser setDelegate:self]; 
[xmlParser setShouldProcessNamespaces:NO]; 
[xmlParser setShouldReportNamespacePrefixes:NO]; 
[xmlParser setShouldResolveExternalEntities:NO]; 
[xmlParser parse]; 

回答

0

你可以在 - (void)dealloc方法中分解xmlParser。

1

可以釋放解析方法稱爲

[xmlParser parse]; 
[xmlParser release]; 

注意parse;是如果成功和NO如果不是之後。所以你可能想在發佈之前做一些相關的操作。