我的方法是不能釋放該變量IOS
-(void)readAppFile
{
NSString *plistPath = [self getDataFileDestinationPath];
NSData *plistXML = [[NSFileManager defaultManager] contentsAtPath:plistPath];
NSString *errorDesc = nil;
NSPropertyListFormat format;
NSMutableDictionary *temp = (NSMutableDictionary *) [NSPropertyListSerialization propertyListFromData:plistXML mutabilityOption:NSPropertyListMutableContainersAndLeaves format:&format errorDescription:&errorDesc];
if (!temp) {
NSLog(@"Error reading plist: %@, format: %d", errorDesc, format);
}
items = [[temp objectForKey:@"Items"] mutableCopy];
NSLog(@"temp %lu", (unsigned long)[temp retainCount]);
[temp release];
}
當我加入了[temp release];
- 但事情是錯誤的,我的方法是崩潰。不明白是什麼錯誤..正如我從內存泄漏儀器可以看到的 - 我需要釋放這個變量..任何幫助?
您可以發佈您收到的錯誤消息嗎?或者可能是一個崩潰日誌? – JDx 2013-04-08 13:49:29
請仔細閱讀本文:[何時使用-retaincount?](http://whentouseretaincount.com) – 2013-04-08 14:02:05
@DavidRönnqvist很好的鏈接,謝謝! – ShurupuS 2013-04-08 14:34:55