我的应用程序是完全无泄漏的(我认为),但有一件事情据说泄漏了很多。所以这里是:
mainPath = [[NSBundle mainBundle] bundlePath];
levelConfigPlistLocation = [mainPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.plist",CATEGORY]];
levelConfig = [[NSDictionary alloc] initWithContentsOfFile:levelConfigPlistLocation];
这是我使用它的方式:
NSString *question = [[[levelConfig objectForKey:LEVELSETSTRING]objectForKey:LEVELSTRING]objectForKey:@"question"];
questionLabel = [CCLabelTTF labelWithString:question dimensions:CGSizeMake(820.0f,360.0f) alignment:UITextAlignmentCenter fontName:@"helvetica" fontSize:32.0f];
questionLabel.position = ccp(screenSize.width/2-30 ,screenSize.height);
questionLabel.color = ccc3(255,255,255);
[self addChild:questionLabel z:5];
和:
NSString *answer = [[[levelConfig objectForKey:LEVELSETSTRING]objectForKey:LEVELSTRING]objectForKey:@"answer"];
for (int i=0; i < [answer length]; i++)
{
NSRange r = NSMakeRange(i, 1);
NSString *ichar = [answer substringWithRange:r];
[characters addObject:ichar];
}
而且,在-dealloc
我发布它时:
[levelConfig release];
Instruments 向我展示了以下泄漏:
其中,当我双击时,总是显示同一行,即:
这显然是 levelconfig 的泄漏......但我该怎么办?