Please help me learn how to use HealthKit.

Discussion in 'iOS Programming' started by moonman239, Sep 19, 2014.

  1. moonman239 macrumors 68000

    Joined:
    Mar 27, 2009
    #1
    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.
     
  2. TheWatchfulOne, Sep 19, 2014
    Last edited: Sep 19, 2014

    TheWatchfulOne macrumors 6502

    TheWatchfulOne

    Joined:
    Jun 19, 2009
    #2
    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:
     
  3. moonman239 thread starter macrumors 68000

    Joined:
    Mar 27, 2009
    #3
    Thanks, but I managed to find the answer. Apparently you have to get the data from the store object you're supposed to initialize.
     

Share This Page