Home > database >  How to fake HealthKit data so it looks like it comes from another app?
How to fake HealthKit data so it looks like it comes from another app?

Time:09-03

I am building an app just for myself (not App Store friendly) and want to store mindfulness minutes such that it looks like the data is coming from a different app. Is it possible to change the source of the data that you save to HealthKit?

CodePudding user response:

It is impossible because iOS will manage this. Your app just uses HealthKit's API to interact with Healths's data.

The system needs to control this because it relates to permission and privacy. It helps HealthKit to identify and prevent app A can delete the data of app B, which is written to Health's data storage by app B.

Ref: https://developer.apple.com/documentation/healthkit/hkhealthstore/1614163-delete

Your app can delete only those objects that it has previously saved to the HealthKit store. If the user revokes sharing permission for an object type, you can no longer delete those objects. This method operates asynchronously. As soon as the delete operation is finished, it calls the completion block on a background queue.

  • Related