I read a plist into memory and need to change one of the values if a user taps on a row.
I read the plist into memory and then show it on a table view.
This is the read into memory:
self.questions = [NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"q1" ofType:@"plist"]];
Then I need to update one of the values, just while its in memory. I guess I could make another whole array but it seems as though I should be able to do something like this:
[[[self.questions valueForKey:title] objectAtIndex:indexPath.row] valueForKey:@"Checked"] = @"1";
When run this I get an error saying the value is read only. Short on making another array to handle the checked off and on, is there a way to do this?
thank you!
Use
+[NSPropertyListSerialization propertyListWithData:options:format:error:]to decode the contents of the file, and pass either theNSPropertyListMutableContainersoption or theNSPropertyListMutableContainersAndLeavesoption.