Skip to content

Commit

Permalink
Support explicit UUIDs
Browse files Browse the repository at this point in the history
  • Loading branch information
mphill committed Nov 28, 2024
1 parent 5ee5c1c commit 45bfd0f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ios/ReactNativeHealthkit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -283,13 +283,13 @@ class ReactNativeHealthkit: RCTEventEmitter {
}

let identifier = HKQuantityTypeIdentifier.init(rawValue: typeIdentifier)
let sampleUuid = UUID.init(uuidString: uuid)!

guard let sampleType = HKObjectType.quantityType(forIdentifier: identifier) else {
return reject(TYPE_IDENTIFIER_ERROR, "Failed to initialize " + typeIdentifier, nil)
}

let samplePredicate = HKQuery.predicateForObject(with: sampleUuid)
// https://developer.apple.com/documentation/healthkit/hkquery/1614783-predicateforobjectwithuuid
let samplePredicate: NSPredicate = NSPredicate(format: "%K == %@", HKPredicateKeyPathUUID, uuid)

store.deleteObjects(of: sampleType, predicate: samplePredicate) { (success: Bool, _: Int, error: Error?) in
guard let err = error else {
Expand Down

0 comments on commit 45bfd0f

Please sign in to comment.