我有没有ARC的方法来读取plist文件内容:
-(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(@"Read file!");
}
我这里有很大的内存泄漏!所以我用这一行替换了代码的结尾,items = [[[temp objectForKey:@"Items"] mutableCopy] autorelease];
但现在我有了Thread 1: EXC_BAD_ACCESS (code=1, addres=0x6000000008)
. 今天是第二天我不知道用这个方法做什么。