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 =
I suspect your problem is due to the fact that you can't write to the application bundle, only to your application's document store.
To obtain a path to the document store, use:
NSArray *searchPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *docStorePath = [searchPaths objectAtIndex:0];
NSString *filePath = [docStorePath stringByAppendingPathComponent:@"XXXXX"];
You can't write into the bundle. Try writing into the documents directory. For example:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSArray *array = [[NSArray alloc]initWithObjects:@"First", @"Second", @"Third", nil];
[array writeToFile:[documentsDirectory stringByAppendingPathComponent:@"Here.plist" atomically:YES];