Measurement Units user preference in Cocoa

September 24, 2006

In OSX you can switch between U.S. and Metric units by opening up the International preferences in System Preferences. Accessing this value from your Cocoa application isn’t well documented, but it’s actually stored right in [NSUserDefaults standardUserDefaults] along with a lot of other localization info. It’s a boolean value with the key “AppleMetricUnits”, and as the name implies its value is true if the user selected metric measurement units in System Preferences.

Marc Charbonneau is a mobile software engineer in Portland, OR. Want to reply to this article? Get in touch on Twitter @mbcharbonneau.