Type Method

predicateForObjectsWithUUIDs:

Returns a predicate that matches the objects with the specified universally unique identifiers (UUIDs).

Declaration

+ (NSPredicate *)predicateForObjectsWithUUIDs:(NSSet<NSUUID *> *)UUIDs;

Parameters

UUIDs

The set of UUIDs to be matched.

Return Value

A predicate that matches the specified objects based on their UUIDs.

Discussion

HealthKit assigns a UUID to each object when it is saved to the HealthKit store. HealthKit uses these IDs to uniquely identify objects from the store. Use this convenience method to create a predicate that checks an object’s UUID against the provided set of UUIDs. The following sample uses both the convenience method and a predicate format string to create equivalent predicates.

NSPredicate *uuids = [HKQuery predicateForObjectsWithUUIDs:myUUIDs];
 
NSPredicate *explicitUUIDs = [NSPredicate predicateWithFormat:@"%K IN %@",
                              HKPredicateKeyPathUUID,
                              myUUIDs];

See Also

Creating Object Predicates

+ predicateForObjectWithUUID:

Returns a predicate that matches an object with the specified universally unique identifier (UUID).

+ predicateForObjectsFromSource:

Returns a predicate that matches all the objects that were created by the provided source.

+ predicateForObjectsFromSources:

Returns a predicate that matches all the objects that were created by any of the provided sources.

+ predicateForObjectsFromDevices:

Returns a predicate that matches all the objects that were created by any of the provided devices.

+ predicateForObjectsWithDeviceProperty:allowedValues:

Returns a predicate that matches all objects created by devices with the specified properties.

+ predicateForObjectsFromSourceRevisions:

Returns a predicate that matches all the objects that were created by any of the provided source revisions.

+ predicateForObjectsWithMetadataKey:

Returns a predicate that matches any object whose metadata contains the provided key.

+ predicateForObjectsWithMetadataKey:allowedValues:

Returns a predicate that matches objects based on the provided metadata key and an array of target values.

+ predicateForObjectsWithMetadataKey:operatorType:value:

Returns a predicate that matches objects based on the provided metadata key, value, and operator.

+ predicateForObjectsWithNoCorrelation

Returns a predicate that matches all objects that are not associated with a HealthKit correlation.