우선 n00b입니다. 노력과 연구의 오랜 시간 후에 나는 어떤 외부 도움을 얻기로 결정했습니다. 내 프로젝트 : 나는 아이들을위한 책을 만들었습니다. 이제 코드를 분석하고 일부 누출을 제거하려고합니다 (잠시 후 레벨 1 + 2 크래시). 다음은 나의 코드입니다Xcode는 객체의 잠재적 누출을 나타냅니다.
- (void)loadView {
_oben = YES;
_unten = NO;
self.view = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
UIImage *cover = [UIImage imageNamed:@"Umschlag.png"]; //Here it says "Potential leak..
//..allocated on line 141 (thats at self.view = [[UIView alloc] initWithFrame:...
image = [[UIImageView alloc] initWithImage:cover];
image.frame = CGRectMake(0, 0, 768, 1024);
[self.view addSubview:image];
[image release];
UITextView *text1 = [[UITextView alloc] initWithFrame:CGRectMake(184, 700, 400, 100)];
text1.backgroundColor = [UIColor clearColor];
text1.textAlignment = UITextAlignmentCenter;
text1.text = NSLocalizedString(@"CoverTextKey1", nil);
[self.view addSubview:text1];
[text1 release];
[self addButtonNext];
[self addSwipeDown];
[self addSwipeUp];
}
아이디어가 있습니까? 누군가 나를 도울 수 있으면 정말 멋지다! 미리 감사드립니다. Planky
@Planky 당신은 환영합니다 :) – albertamg
감사합니다, 지금 나는 누락 된 모든 릴리즈에 넣고 autorelease를했고 모든 누출 가능성은 사라졌습니다. 슬프게도 여전히 충돌하지만 또 다른 주제입니다. 어쨌든 시간 내 주셔서 감사합니다! – Planky
또 다른 대안은 속성이 아닌 인스턴스 변수에 할당하는 것입니다. 물론이 경우 속성에 현재 nil이 아닌 포인터가 포함되어 있지 않은지 확인해야합니다. (확실하지 않은 경우 속성에 nil을 먼저 할당하십시오.) –