BalestraPatrick
BalestraPatrick

Reputation: 10144

Where does HealthKit read the default units?

I would like to know where does the Health.app read the unit for the weight. Mine is always set to Kg but I'm not able to find an option to toggle this. The HealthKit framework supports multiple units for weight: Kilogram, Gram, Ounce, Pound and Stone.

I'd like to know if there's an API to get the current Health.app weight unit so I can directly use that unit in my app too.

Any idea?

Upvotes: 3

Views: 1121

Answers (2)

Allan
Allan

Reputation: 7353

Update: In the latest iOS 8.2 beta, there is a new API -[HKHealthStore preferredUnitsForQuantityTypes:completion:] that allows applications to access the user's preferred units for any HKQuantityType that the app is authorized to read or write.

The Health app uses different units for different types depending on the locale set for the device. For instance in the United States pounds are used to display weight but in locales that use the metric system kilograms will be used instead. Starting in iOS 8.2, the user may also specify a unit they prefer for many quantity types in the Health app.

Upvotes: 4

superarts.org
superarts.org

Reputation: 7238

You may have to check user's locale and set the correct units manually.

Upvotes: 1

Related Questions