I have an obj-C Mac app with an object observing some property (bool) of standardUserDefaults.
The code is pretty standard:
[[NSUserDefaults standardUserDefaults] addObserver:self forKeyPath:@"property" options:NSKeyValueObservingOptionNew context:nil];
This standardUserDefaults' property is bound to an NSButton state.
When I click the button, the property changes as normal, but up to 8 messages in a row notifying a change in the property are received at each click! I have no idea why that is. The property is not bound to anything else but the button. I checked that the button is indeed clicked once. The value of the property is the same across notifications resulting from the same click.
This also occurs without binding if I manually change the property via
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"property"];
After that, 8 observeValueForKeyPath: messages are received in a row!
The only related issue I found was this one: https://developer.apple.com/forums/thread/47609.
Any idea?