Question

In my project, I have an NSArrayController bound to save to a the application's standard defaults (NSUserDefaults). This in itself works perfectly - objects added are saved and restored as expected.

However, if I programmatically modify one of the NSMutableDictionaries contained in the NSArrayController's array, none of the changes are saved. Only values set with the creation of the dictionary seem to stick.

I suspect this is because simply calling setObject:forValue: on the dictionaries in the array doesn't notify the controller of changes, but I'm not sure. Am I doing something wrong?

UPDATE: I have since switched from NSMutableDictionary to a custom object that conforms to KVC (to the best of my knowledge - I'm using properties so that should be taken care of) as well as NSCoding. It can and does save and restore fine - it's just not consistent. It kinda saves whenever it feels like it instead of when I update a property.

Was it helpful?

Solution

Well, I ended up just writing my own controller responsible for loading and saving downloads to their own plist file. It saves when it's told to without fail, so the problem is solved.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top