Reputation: 2352
I have enabled background delivery for HealthKit data and everything required. The only thing confusing me is that where I will get notified when there are some updates in Health app. In completion handler of enableBackgroundDelivery
method or in app delegate on app launch.
Upvotes: 0
Views: 502
Reputation: 100503
The completion gives whether enable is succeeded or not only ,From Doc HealthKit
HealthKit wakes your app whenever new samples of the specified type are saved to the store. Your app is called at most once per time period defined by the specified frequency.
As soon as your app launches, HealthKit calls the update handler for any observer queries that match the newly saved data. If you plan on supporting background delivery, set up all your observer queries in your app delegate’s application(:didFinishLaunchingWithOptions:) method. By setting up the queries in application(:didFinishLaunchingWithOptions:), you ensure that the queries are instantiated and ready to use before HealthKit delivers the updates.
Upvotes: 1