This sample shows a simple use of the iOS HealthKit APIs.
This sample shows a simple use of the iOS HealthKit APIs.
It is a very simple scenario but should help you out to get started if you want to work with this SDK. The most important part of the sample is located in main.js file. Here is a snippet of code used to initialize the HealthKit SDK
if (HKHealthStore.isHealthDataAvailable()) {
var weightType = HKObjectType.quantityTypeForIdentifier(HKQuantityTypeIdentifierBodyMass);
var writeDataTypes = NSSet.setWithObject(weightType);
var readDataTypes = NSSet.setWithObject(weightType);
var healthStore = HKHealthStore.new();
healthStore.requestAuthorizationToShareTypesReadTypesCompletion(readDataTypes, readDataTypes, function (success, error) {
if (!success) {
...
To run this example you must enable HealthKit in you xCode project:
If you have any questions about the sample please open an issue in our issues repo or post directly in NativeScript forums.