I have a very basic question about how to write to a plist. I added a "Here.plist" file to my resources folder. The following is my code:
NSString *path = [[NSBundle mainBundle]pathForResource:@"Here" ofType:@"plist"]; NSArray *array = [[NSArray alloc]initWithObjects:@"First", @"Second", @"Third", nil]; [array writeToFile:path atomically:YES];
"Here.plist" is still empty after executing the code. I even tried using a NSDictionary as follows:
NSDictionary *dict = [[NSDictionary alloc]initWithObjectsAndKeys:@"firstValue", @"First", @"secondValue", @"Second", @"thirdValue", @"Third", nil]; [dict writeToFile:path atomically:YES];
I went through many tutorials and forums but its just not working for me. What am i doing wrong? Losing my head over this.