Using HealthKit, I am saving
I'm running the same code on the apple watch and on the iPhone.
When I'm saving on the iPhone
When I'm saving on the apple watch
When I'm saving on the apple watch and delete it in my iPhone App
When I'm saving on the apple watch and delete it in my Apple Watch App
Question
Am I doing something wrong or is this the way HealthKit and the iPhone Activity App works?
More specific question:
If this is not my mistake, no iOS app could reliably save workouts that are shown in the activity app. The iOS app could send the data to the watch app, that is the easy part. But I know no way to process this data on the watch in background. The user has to start the watch app to process the data.
The tests were made on hardware, not on a simulator. iOS 9.2.1, watchOS 2.1
I added tests using watchOS 2.2 beta 5 + iOS 9.3 beta 5. I edited the results above. Summary: deleting is fixed, Saving on the iPhone still doesn't work.
With iOS 9.3 / watchOS 2.2, Apple added HKActivitySummary
, HKActivitySummaryQuery
and HKActivityRingView
. In short: everything said about the activity app on the iPhone also applies to HKActivitySummaryQuery. They share features and bugs described above.
This is definitely something that is tricky to navigate at the moment! There are three distinct issues with separate explanations.
When you save a workout on the iPhone:
When you save the workout on Apple Watch and delete it in the iPhone App:
HKWorkout
sample is not sufficient to delete the samples that you associated with that workout. For example, you need to delete the associated active energy samples explicitly if you don't want them to exist anymore. That said, deleting the workout should remove its contribution from the Activity rings. If it doesn't, then that sounds like a bug that would be worth filing separately since your original bug was probably interpreted as a request to have workouts from iPhone count in Activity.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