Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to add metadata to an HKWorkout after it's already been saved?

Can I read out an HKworkout and add my own metadata to it, then resave it? If so how? Or can I only pass in metadata when I'm saving the workout?

like image 500
GarySabo Avatar asked Oct 23 '25 18:10

GarySabo


1 Answers

All HKObjects are immutable (the cannot be edited once saved). The recommend approach to editing an HKObject is to save a new copy with the changes you want to make and to delete the previous copy. You can only do this if your app created the original object, though.

like image 66
Allan Avatar answered Oct 26 '25 08:10

Allan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!