kenvu
kenvu

Reputation: 343

iOS read data from HealthKit

I have an app that read data from HealthKit. I can read data from it successfully. However I noticed an issue. When the Health app is not open and I try to read data from it, HealthKit just returns old data, any new data like steps that I've just taken is not returned. So I wait for about 45 minutes, then the latest data is returned. BUT when I open HealthKit app at that time (instead of waiting 45 minutes), latest data is returned. I'm not sure if it would take sometimes for HealthKit to return latest data to 3rd party app, or we can force HealthKit to return latest data by openning Health app. Is this a bug?

Upvotes: 3

Views: 2410

Answers (1)

Kelvin Lau
Kelvin Lau

Reputation: 6771

It's not a bug. As far as I know, there is no way of forcing HealthKit from returning the latest data, because the data is not actually inside the Health Store yet.

Health Store receives data in batches, periodically. An Apple employee previously stated this on the developer forums (In a WatchKit thread, actually). The time he stated was "Around 15 minutes".

Upvotes: 2

Related Questions