An object that represents a sample that has been deleted from the HealthKit store.
- iOS 9.0+
- watchOS 2.0+
HKAnchored queries to generate a list of recently deleted objects. Create a query using the
init(type:method. When the system calls the result handler, it passes the
deleted parameter an array of
HKDeleted instances matching the query.
Deleted objects are temporary; the system may remove them from the HealthKit store at any time to free up space. To guarantee that you receive notifications for all deleted objects, create an
HKObserver and register it for background delivery. The system then wakes your app and calls the observer query’s update handler whenever the matching objects change—including deletions. However, the query does not provide a list of deleted objects. To determine which objects were deleted, use the observer query’s update handler to create an anchored object query for the newly deleted objects.