2
我有这段代码从文件中加载一组属性,然后分配它。NSKeyedUnarchiver内存泄漏
NSMutableData* data = [NSData dataWithContentsOfFile:fullPath];
NSKeyedUnarchiver* unarc = [[NSKeyedUnarchiver alloc] initForReadingWithData:data];
NSMutableArray* loadedLibraries = [unarc decodeObjectForKey:@"libraries"];
IRStudyPlan* loadedStudyPlan = [unarc decodeObjectForKey:@"currentStudyPlan"];
NSMutableDictionary* loadedWordLists = [unarc decodeObjectForKey:@"wordLists"];
NSMutableDictionary* loadedStudyPlanList = [unarc decodeObjectForKey:@"studyPlanList"];
[unarc finishDecoding];
[self setLibraries:loadedLibraries];
[self setStudyPlanList:loadedStudyPlanList];
[self setCurrentStudyPlan:loadedStudyPlan];
[self setWordLists:loadedWordLists];
[unarc release];
我想知道为什么我在每个对象上都有内存泄漏。我的initWithCoder是这一个,类似的所有对象:
-(id)initWithCoder:(NSCoder *)decoder{
if([super init]!=nil){
[self setListName:[decoder decodeObjectForKey:@"listName"]];
[self setWordsWithStatistics:[decoder decodeObjectForKey:@"wordsWithStatistics"]];
[self setWordsWithStatisticsInGame:[decoder decodeObjectForKey:@"wordsWithStatisticsInGame"]];
}
return self;
}
任何人都可以告诉我吗?
非常感谢您