EddyVerbruggen / HealthKit

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

Deleting previously saved data on healthkit #70

Open vgupta16 opened 8 years ago

vgupta16 commented 8 years ago

The HKHealthStore object has a method deleteObject:withCompletion which can delete previously saved objects. Are there plans to integrate this functionality in the plugin?

Thanks! Varun

EddyVerbruggen commented 8 years ago

Sounds interesting! Do you have an opportunity to try and add it yourself perhaps?

vgupta16 commented 8 years ago

I currently do not have any experience with objective C, but with some of your assistance I may be able to implement this if it is something you think will only take a couple hours to complete.

mattsilv commented 7 years ago

Here are the docs for the deleteobjects method: https://developer.apple.com/reference/healthkit/hkhealthstore/1614163-deleteobjects?language=objc

Other info that might be helpful: http://stackoverflow.com/questions/35922734/deleting-a-water-sample-from-healthkit

mnill commented 7 years ago

I implement deleteObjects in my fork: https://github.com/mnill/HealthKit

window.plugins.healthkit.deleteObjects({
          'type': type,
          'startDate': new Date(new Date().getTime() - 1000*60*60*24*365),
          'endDate': new Date(),
          },
          callback,
          callback
          );

Sample or quantity type in ’type’ field :-). If you want to delete workOut - type must be ‘workoutType’ Please test it and give me feedback, I no have project to test it in the wild.

EddyVerbruggen commented 7 years ago

@mnill Oh boy, I just pushed a similar change earlier today: #84