HKDeleted class is used to represent samples that have been deleted from the HealthKit store.
- iOS 9.0+
- watchOS 2.0+
HKAnchored queries to generate a list of recently deleted objects. Create the query using the
init(type: method. When the result handler is called, it’s
deleted parameter contains an array of
HKDeleted instances that match the query.
However, deleted objects are temporary. The system eventually removes them from the store. Because users may run your app infrequently, if you want to guarantee that you receive notifications about all the deleted objects, use
HKObserver queries set for background delivery. In the observer query’s update handler, perform the anchored object query to determine which objects were deleted.