6

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)...

4

1 回答 1

7

使用deleteObject:withCompletion:API 删除您保存的对象。如果您保存了一个,HKCorrelation则还必须删除您保存的每个具有相关性的对象。

于 2014-09-29T00:32:10.800 回答