Apple recently made heart hate raw data avaliable through healthkit, but the documentation is very confusing and I can not understand exactly how to measure the heartbeat of someone wearing the watch. I could not find any good examples on the internet either, so I'm hoping that someone could help me understand how can I get these values in a easy way.
-
1Look at the HealthKit documentation. – Mundi Jul 22 '15 at 20:38
-
Check the following example: http://stackoverflow.com/questions/27002910/is-there-any-way-to-access-the-accelerometer-from-the-apple-watch/30985555#30985555 – casillas Jul 23 '15 at 20:45
1 Answers
The key is to check out HealthKit, not WatchKit. From the docs:
Setting Up HealthKit
Before you can begin using HealthKit, you must perform the following steps:
Enable the HealthKit capabilities in Xcode.
Check to see whether HealthKit is available by calling the isHealthDataAvailable method. HealthKit is not available on iPad. Additionally, HealthKit can be disabled on other devices—for example, iPhones that are provisioned for schools or corporate environments.
Instantiate an HKHealthStore object for your app. You need only one HealthKit store per app. This store acts as your primary interface with the HealthKit database.
Request authorization to access HealthKit data using the requestAuthorizationToShareTypes:readTypes:completion: method. HealthKit requires fine-grained authorization. You must request permission to share and read each type of data.
Etc....