I have followed this answer to write data to the plist
How to write data to the plist?
But so far my plist didn't change at all.
Here is my code :-
- (IBAction)save:(id)sender
{
NSString *path = [[NSBundle mainBundle] pathForResource:@"drinks" ofType:@"plist"];
NSString *drinkName = self.name.text;
NSString *drinkIngredients = self.ingredients.text;
NSString *drinkDirection = self.directions.text;
NSArray *values = [[NSArray alloc] initWithObjects:drinkDirection, drinkIngredients, drinkName, nil];
NSArray *keys = [[NSArray alloc] initWithObjects:DIRECTIONS_KEY, INGREDIENTS_KEY, NAME_KEY, nil];
NSDictionary *dict = [[NSDictionary alloc] initWithObjects:values forKeys:keys];
[self.drinkArray addObject:dict];
NSLog(@"%@", self.drinkArray);
[self.drinkArray writeToFile:path atomically:YES];
}
Do I need to perform something extra?
I am new to iPhone SDK so any help would be appreciated.