How does OS X's defaults command get access to prefs of sandboxed apps?
问题 I am writing a preferences editor tool (see http://www.tempel.org/PrefsEditor). It is effectively a GUI version of the defaults command. I have trouble reading (let alone writing) preferences of random sandboxed applications, though. For instance, when I try to get the keys of the Maps app, I get NULL returned: CFArrayRef prefs = CFPreferencesCopyKeyList (CFSTR("com.apple.Maps"), kCFPreferencesCurrentUser, kCFPreferencesAnyHost); However, the defaults command is able to read those prefs: