In an app I bound an NSArrayController's content array to a NSUserDefaultsController like this:
[_arrayController bind:NSContentArrayBinding toObject:_userDefaultsController withKeyPath:@"values.anArrayOfDictionaries" options:nil];
This works as expected. If I add objects to the array controller or remove them, the user defaults are updated accordingly. But if I modify the content array in any other way, this seems not to trigger KVO and the user defaults are not updated. I tried various combinations of:
[self.arrayController willChangeValueForKey:...];
...
[self.arrayController didChangeValueForKey:...];
but it did not work. So I ended up doing the following:
[_userDefaults setObject:[_arrayController content] forKey:anArrayOfDictionaries];
This works but I am pretty sure there must be a better way to get the changes I made to the array controller's content array into the user defaults.
Thanks in advance for your help.
Regards,
Marc