Find HKObject by UUID

531 views Asked by At

In my app users can do workouts and they get listed in my app. If a user wants to delete a workout inside my app, I'd like to offer him to also delete it from HealthKit. But I can't seem to find a way to fetch an HKObject by it's uuid?!? Is that not possible? Cause creating a HKSampleQuery and use uuid == <The-workout-UUID> does not work. It will crash any say that this keypath (even though ever HKObject has an uuid) is not valid...

1

There are 1 answers

1
Allan On BEST ANSWER

You can use the HKQuery convenience method predicateForObjectWithUUID: to match an object with a specific UUID (documentation here).