每次我调用此方法时,我的 NSMutableData 都会泄漏,我无法弄清楚如何插入它。在分配和初始化解码器后,theData 的保留计数增加了 1,我不知道为什么。我在方法结束时被保留计数为 2 并试图释放它会导致应用程序崩溃。
- (void)readVenueArchiveFile:(NSString *)inFile key:(NSString *)inKey
{
NSMutableData *theData;
NSKeyedUnarchiver *decoder;
theData = [NSData dataWithContentsOfFile:inFile];
decoder = [[NSKeyedUnarchiver alloc] initForReadingWithData:theData];
venueIOList = [[decoder decodeObjectForKey:inKey] mutableCopy];
[decoder finishDecoding];
[decoder release];
}