Reputation: 10328
Is there any way to modify the meta data within the HKObject after it is created? I know we can modify the metadata(NSdictionary) during creation, but what if I need to add extra data into it after?
Upvotes: 0
Views: 748
Reputation: 7353
Objects stored in HealthKit are immutable. If you need to change an object that you previously saved, you should save a new copy of the object with the modifications you want to make and delete the object you saved previously.
Upvotes: 3
Reputation: 10328
One way I can get around this is to create a new QuantitySample and just copy everything else like date range and modify the Metadata. The only thing i'm worried is the UUID will be different and messes somethings up that depends on it. Maybe another app that reads it from health kit may depend on it?
Upvotes: 0