I am getting memory leaks pointing to the line "NSDictionary *dw = [NSDictionary dictionaryWithContentsOfFile:path];
" by using following code
NSDictionary *_allData;
@property (nonatomic, retain) NSDictionary *allData;
@synthesize allData = _allData;
+ (NSString*)getNSPath
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *path = [documentsDirectory stringByAppendingPathComponent:@"alarm.plist"];
return path;
}
- (NSDictionary *)allData
{
NSString *path = [saveAlarm getNSPath];
NSDictionary *dw = [NSDictionary dictionaryWithContentsOfFile:path];
_allData = [NSDictionary dictionaryWithDictionary:dw];
return _allData;
}
The data are changing in the pList and when I ask to retrieve what is new there by property then it leaks. Any recommendation how to make clear? Or how to implement this kind of thing without leaks?
Thanks