Healthkit multiple HKAnchoredObjectQuery not returning data for all sample types
This is expected. The query's initializer takes a type parameter only returns results of that type. You cannot query for multiple types of samples with a single query.
HKAnchoredObjectQuery updateHandler not being called
My UITableViewController
was in a UIPageViewController
. viewDidAppear()
on the UITableViewController
does not get called when returning from the detail screen, so I assumed viewDidDisappear()
would not get called as well and I was stopping the query in there. My assumption was wrong.
A question on where to stop long running HKQuery
s: Do HKQuery's need to be stopped in View Controllers
How do I use Healthkit observer queries with background delivery without prompting non-HK users for permissions?
One possible flow is:
In
didFinishLaunching
, checkUserDefaults
for a Boolean that indicates the user has approved HealthKit integration. If it istrue
then call a function to set up your observer queries.At the point in your app execution where the user indicates that they want to provide access to HealthKit data, prompt for permission and then set the Boolean in
UserDefaults
once you have permission.At this point you would also call your function to set up your observer queries so that you start receiving data.
Related Topics
Spritekit Not Respecting Zposition
How to Add Action to Uialertview in Swift (iOS 7)
How to Figure Out When a HTML5 Video Player Enters The Full Screen Mode on iOS/Ipads
Raw Depth Map Sdk for iPhone X
No Such Module Iqkeyboardmanagerswift
Google Signin: Unable to Disconnect iOS App
How Has The Nsindexpath Initialization Changed in Swift3
iOS 8 [Uiapplication Sharedapplication].Scheduledlocalnotifications Empty
Uiactivityviewcontroller => Launchservices: Invalidationhandler Called
iOS How to Get a List of Already Purchased Products
Hls Video Streaming on iOS/Safari
How to Override Convenience Init in Uialertcontroller for Swift
Uitabbar Change Background Color of One UItabbaritem on iOS7
Reusing View in UIpickerview with iOS 7
Camera Only Takes Pictures in Portrait Mode Swift