views:

53

answers:

2

This method in my class reads a previously created plist, but when it does NSPropertyListSerialization leaks all over the place. NSDates and NSCFStrings, mostly. Any suggestions on what I can do to prevent this?

- (id)readPlist:(NSString *)fileName {  

    NSData *plistData;  
    NSString *errorA;  
    NSPropertyListFormat format;  
    id plist;  

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *localizedPath = [[paths objectAtIndex:0] stringByAppendingPathComponent:fileName];  
    plistData = [NSData dataWithContentsOfFile:localizedPath];   

    plist = [NSPropertyListSerialization propertyListFromData:plistData mutabilityOption:NSPropertyListImmutable format:&format errorDescription:&errorA];  
    if (!plist) {  
        DLog(@"Error reading plist from file '%s', error = '%s'", [localizedPath UTF8String], [errorA UTF8String]);  
        [errorA release];  
    }

    return plist;  
} 
A: 

You might try the propertyListWithData:options:format:error: method instead.

Peter Hosey
Thanks. No difference. Still leaking like a sieve! :)
E-Madd