100.0 % 표시가 보라색에서 내 응용 프로그램은 잘 작동하지만, 내가 누출을 확인하기 위해 악기를 실행할 때, 그것은 나에게 코드 줄에서 누출을 보여줍니다메모리 누수 코드
xmlParser = [[NSXMLParser alloc] initWithContentsOfURL:url];
여기이 줄을 포함하는 방법이다 :
-(NSString*) languageSelectedStringForKey:(NSString*) key
{
NSString *path = [[NSBundle mainBundle] pathForResource:@"zh" ofType:@"lproj"];
if(selectedLanguage==French)
{
FinalString = [[NSString alloc] initWithFormat:@"http://www.xyz.com/api_com.php?page_id=%d",IDValue];
url = [[NSURL alloc] initWithString:FinalString];
}
else if(selectedLanguage==German)
{
FinalString = [[NSString alloc] initWithFormat:@"http://www.x.com/api_com.php?page_id=%d",IDValue];
url = [[NSURL alloc] initWithString:FinalString];
}
else if(selectedLanguage==Nepali)
{
FinalString = [[NSString alloc] initWithFormat:@"http://www.xy.com/api_com.php?page_id=%d",IDValue];
url = [[NSURL alloc] initWithString:FinalString];
}
xmlParser = [[NSXMLParser alloc] initWithContentsOfURL:url];
[url release];
//Initialize the delegate.
parser = [[NewsParser alloc] initXMLParser];
//Set delegate
[xmlParser setDelegate:parser];
//Start parsing the XML file.
BOOL success = [xmlParser parse];
if(success)
NSLog(@"No Errors");
else
NSLog(@"Error Error Error!!!");
NSBundle* languageBundle = [NSBundle bundleWithPath:path];
NSString* str=[languageBundle localizedStringForKey:key value:@"" table:nil];
return str;
}
여기 languageSelectedStringForKey
가 호출되는 내 ViewDidLoad
방법입니다.
- (void)viewDidLoad
{
// Do any additional setup after loading the view from its nib.
appDelegate = (ProgAppDelegate *)[[UIApplication sharedApplication] delegate];
IDValue = 1;
textLabel.text=[self languageSelectedStringForKey:@"Welcome to Advance Localization"];
[super viewDidLoad];
}
이 누출의 원인은 무엇이며 어떻게 해결할 수 있습니까?
이 인의 dealloc 방법 : -
- (void)dealloc
{
[xmlParser release];
[parser release];
[nibLoadedCell release];
[super dealloc];
}
iOS 6가 장착 된 기기에서 누출 프로파일 링이 있습니까? 비슷한 누출이 있었고 iOS 5가있는 장치에서 프로파일 링을하면 누출이 사라집니다. 그래서 애플의 소스 코드에서 문제를 지적 할 수 있을까? – iMathieuB