User can now change the units of related data types like weight and height in iOS 8.2.
use preferredUnitsForQuantityTypes of HKHealthStore to set preferred unit type.
use HKUserPreferencesDidChangeNotification as notification key to monitor if there are any changes.
HKObjectsource of HKObject had been removed.
Added sourceRevision for storing sourceRevision and source with that object
Added new device property for storing related health devices information. use class function localDevice() for getting the current device's information.
HKQuery is added for querying HealthKit databases
deleteObjects is added for deleting multiple HKObject
deleteObjectsOfType(objectType:predicate:completion) for deleting objects fits the predicate
No easy way for tracking deleted object in iOS 8
HKAnchoredObjectQuery for query all sample with predicate provided. The result also includes delete objects for developers to sync their app databases.
Background delivery
invoke enableBackgroundDeliveryForType of HKHealthStore for sending info to third parties app.
use updateHandler of HKAnchoredObjectQuery to be informed whenever there are updates.
Steps:
HKWorkoutSessionHKAnchoredObjectQueryHKWorkout and related sample