EddyVerbruggen / HealthKit

Cordova plugin for the iOS HealthKit framework
MIT License
167 stars 215 forks source link

Permissions and Workout data? #123

Open tomfloate opened 3 years ago

tomfloate commented 3 years ago

We are having issues with the permissions on this to get both step data AND workout data at the same time. Also the plugin for getting workout data takes no parameters and returns every workout ever? Is there no alternative/a better way to do this?

The functions we are using...

Workouts - findWorkouts()

The call we want to use to get Workout permission as well is called requestAuthorization(). It feels like we cant find the correct identifier to get workouts here as well as step data.

Our current requestAuthorization call is as below:

requestOptions: HealthKitOptions = { readTypes: ['HKQuantityTypeIdentifierStepCount'], writeTypes: ['HKQuantityTypeIdentifierStepCount'] }; this.healthKit.requestAuthorization(this.requestOptions).then(success => { console.log('auth success', success); this.checkAppleHealthPermissions(); }, error => { console.log('auth error', error); });

The below call also always hits the error, never the success if they have allowed or denied access:

this.healthKit.findWorkouts().then(success1 => { // for some reason never hits here console.log('workouts1', success1); }, success2 => { console.log('workouts2', success2); });

shahraship commented 2 years ago

Were you ever manage to resolve this? I'm facing the same error...

sachinskumar41 commented 2 years ago

Does anyone get a solution for this?