I'm developing an app that gives the users the option to track what they ate. One of the features the app suggest is to select a food item as Eaten
. When a user does that, I share that info with the HealthKit.
A user can then decide to uncheck that item and return its previous state: Uneaten
. I wonder if I can query the previously saved food item and choose to delete it from the HealthKit as it isn't relevant for the user anymore?
UPDATE
Well, After reading almost the entire documentation of HealthKit I found out that HKHealthStore
object has a method: deleteObject:withCompletion:
. Yet I can't seem to successfully delete an HKCorrelation
that stores the food item I previously saved to HealthKit, though the call finish successfully (I can still see the data in the Health App)...
Use the deleteObject:withCompletion:
API to delete the objects you saved. If you saved an HKCorrelation
you must delete each of the objects you saved with the correlation as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With