Open XaviSmith opened 6 years ago
I looked more into it and it seems whatever StartDate you enter is pushed forward by 1 month in the obj-c (endDate was always whatever date i entered). Working around it by just entering a start date of 1 month earlier than it should be but looks like something to fix in the next release
getSleepSamples() and getBloodPressureSamples() never return any data. I've triple checked that my app has permission to read data from HealthKit and that data is present however both functions never return any data. I think it's those functions particularly because calling getStepCount() with the same setup/options works fine
CODE:
//Pedometer permissions stuff const HKPERMISSIONS = AppleHealthKit.Constants.Permissions;
//Options for all Apple Healthkit features let OPTIONS = { permissions: { read: [HKPERMISSIONS.StepCount, HKPERMISSIONS.SleepAnalysis, HKPERMISSIONS.BloodPressureDiastolic, HKPERMISSIONS.BloodPressureSystolic], write: [HKPERMISSIONS.StepCount] } };
let BLOODOPTIONS = { unit: 'mmhg', // optional; default 'mmhg' startDate: (new Date(2018,5,20)).toISOString(), // required endDate: (new Date()).toISOString(), // optional; default now ascending: false, // optional; default false limit:10, // optional; default no limit }
let SLEEPOPTIONS = { startDate: (new Date(2018,5,20)).toISOString(), // required endDate: (new Date()).toISOString(), // optional; default now //limit:10, // optional; default no limit };
...
AppleHealthKit.initHealthKit(OPTIONS, (err, res) => { if(this._handleHealthKitError(err, 'initHealthKit')) { return; } // healthkit initialized...
...
}