- (NSDictionary*)getDataFromPlist {

NSString *fileName = @"AppInfo.plist";

NSString *path = [[NSBundle mainBundle] bundlePath];

NSString *finalPath = [path stringByAppendingPathComponent:fileName];

NSDictionary *plistData = [[NSDictionary alloc] initWithContentsOfFile:finalPath];


NSLog(@"[getDataFromPlist] %@ content :: %@", fileName, plistData);

return plistData;

}


- (NSUInteger)writeToPlist:(NSUInteger)level withRow:(NSUInteger)row {

NSLog(@"[ writeToPlist ]");

NSString *fileName = @"AppInfo.plist";

NSArray *keys = [[NSArray alloc] initWithObjects:@"Elem", @"Pre", @"Inter", nil];

NSString *path = [[NSBundle mainBundle] bundlePath];

NSString *finalPath = [path stringByAppendingPathComponent:fileName];

NSMutableDictionary *plistData = [[NSMutableDictionary alloc] initWithContentsOfFile:finalPath];

NSMutableArray *contentArray = [plistData objectForKey:[keys objectAtIndex:level]];

[contentArray replaceObjectAtIndex:row withObject:@"1"];

[plistData setValue:contentArray forKey:[keys objectAtIndex:level]];

[plistData writeToFile:finalPath atomically:YES];

return 0;

}


+ Recent posts