Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

moonman239

Cancelled
Original poster
Mar 27, 2009
1,541
32
I'm creating a small app that calculates a user's body mass index. To do this, I need to know how to get the height and weight information. I've read some Apple documentation (here's a link to Apple's HealtKit reference: HealthKit Framework Reference) and am now up to the part of the code that is executed when the HKQuery executed successfully. However, I do not know how to access the data. Will someone please help me? Thanks.
 
From the Class Hierarchy you linked to:

The HealthKit store acts as your link to all the data managed by HealthKit.

The HealthKit object is a piece of data that can be stored inside the HealthKit store.

The HKQuery class is the basis for all the query objects that retrieve data from the HealthKit store.

I would start by reading the references for those Classes to see how they are related and how they interact with each other. I've never messed with HealthKit myself so I can't tell you anything specific.

And just in case you did not know: HealthKit is being withheld until a bug is fixed. You won't be able to release a HealthKit app in the App Store just yet, but don't let that stop you from experimenting and learning it.

After a little further reading...

You might check out this method on HKSampleQuery and see if there's anything about it that interests you.

Code:
initWithSampleType:predicate:limit:sortDescriptors:resultsHandler:
 
Last edited:
From the Class Hierarchy you linked to:







I would start by reading the references for those Classes to see how they are related and how they interact with each other. I've never messed with HealthKit myself so I can't tell you anything specific.

And just in case you did not know: HealthKit is being withheld until a bug is fixed. You won't be able to release a HealthKit app in the App Store just yet, but don't let that stop you from experimenting and learning it.

After a little further reading...

You might check out this method on HKSampleQuery and see if there's anything about it that interests you.

Code:
initWithSampleType:predicate:limit:sortDescriptors:resultsHandler:

Thanks, but I managed to find the answer. Apparently you have to get the data from the store object you're supposed to initialize.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.