my Data in plist is
ArrayKey
item0 100
item1 200
item2 300
My Function is
- (IBAction)Save:(id)sender
{
NSString* plistPath = [[NSBundle mainBundle] pathForResource:@"myPlist" ofType:@"plist"];
NSMutableDictionary *dictionary = [[NSMutableDictionary alloc]
initWithContentsOfFile:plistPath];
NSMutableArray * array = (NSMutableArray *)[dictionary valueForKey:@"ArrayKey"];
[array replaceObjectAtIndex:0 withObject:textView1.text];
[array replaceObjectAtIndex:1 withObject:textView2.text];
[array replaceObjectAtIndex:2 withObject:textView3.text];
NSLog(@"Array is :%@",dictionary);
[dictionary writeToFile:plistPath atomically:YES];
}
Where is wrong. Help please!
Thank you kindly.
The files in your bundle are read only. If you need to write a file, you need to do that elsewhere in the application’s sandbox. (in the user’s documents directory or your app’s /Library or the cache or tmp directories, depending on what this data actually is)