Allow background delivery of HealthKit HKCharacteristicType data
| Originator: | benchatelain | ||
| Number: | rdar://22221216 | Date Originated: | 10-Aug-2015 04:54 PM |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | Xcode7-beta5 (7A176x) |
| Classification: | Enhancement | Reproducible: | Always |
HKHealthStore allows for an app to subscribe to background delivery of any HKObjectType:
func enableBackgroundDeliveryForType(_ type: HKObjectType,
frequency frequency: HKUpdateFrequency,
withCompletion completion: (Bool,
NSError?) -> Void)
type - The type of data to observe. This object can be any concrete subclass of the HKObjectType class (any of the classes **HKCharacteristicType** , HKQuantityType, HKCategoryType, HKWorkoutType or HKCorrelationType).
However, it is not currently possible to set up an HKObserverQuery for HKCharacteristicType as the type is restricted to the HKSampleType subclass of HKObjectType:
init(sampleType sampleType: HKSampleType,
predicate predicate: NSPredicate?,
updateHandler updateHandler: (HKObserverQuery,
HKObserverQueryCompletionHandler,
NSError?) -> Void)
I humbly ask that the HKObserverQuery API be revised to allow observer queries for HKCharacteristicType.
I recognize that HKCharacteristicType values are not expected to change over time and the current API only allows for an app to ask for the “current” value (-dateOfBirthWithError:). However, it is very common for these values to be empty and if they are later filled in, apps that have access to these values should have a way of being informed. Observer queries seem like the perfect mechanism for the “date of birth was just entered” event.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!