Neither class reference nor any tutorial available online say anything about caching anchors between application runs.
I want to query data between app runs so I get all historical HealthKit
entries. At first, I thought I'd need to store last query NSDate
in NSUserDefaults
and on the next app run I'll just hit this value and set it as startDate
of HKSampleQuery
but after some reading I came onto this cool thing called HKAnchoredObjectQuery
which should be handling this caching for me so whenever I hit I'll get only new entries.
Does this class automatically store anchors or it just stores it on app run and when app is terminated everything gets cleared and I'm starting again with HKAnchoredObjectQueryNoAnchor
?