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;
}
任何人都可以告訴我嗎?
非常感謝您