Quoting the NSUserDefaults documentation:
Important
Don’t try to access the preferences subsystem directly. Modifying preference property list files may result in loss of changes, delay of reflecting changes, and app crashes. To configure preferences, use the defaults command-line utility in macOS instead.
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags: