Skip to content

Commit

Permalink
Revert UUID lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
mphill authored and robertherber committed Dec 8, 2024
1 parent 0666119 commit 4fb314a
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)
}

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

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

0 comments on commit 4fb314a

Please sign in to comment.