Observers of NSUserDefaults are notified multiple times

Number:rdar://28579354 Date Originated:
Status:Duplicate of 28162281 (Open) Resolved:
Product:macOS SDK Product Version:macOS 10.12 (16A323)
Classification:Serious Reproducible:Always
When I register an observer against a user preference, my observer is called multiple times with the exact same information. This causes problems when I need to do something like play an audio file in response to the user changing a preference.

Steps to Reproduce:
1. Run attached project
2. Check or uncheck the MyKey checkbox
3. Observe observeValueForKeyPath being called multiple times with the same values.

Expected Results:
Observer should be notified once, as there is only one change.

Actual Results:
Observer is notified multiple times with the same information 

macOS 10.12 (16A323)
Xcode 8.0 (8A218a)


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!