Samples in HealthKit that were manually entered by the user will have have a YES value for the HKMetadataKeyWasUserEntered
metadata key. To create a predicate that matches only samples that were not user-entered, you could do use the following:
[NSPredicate predicateWithFormat:@"metadata.%K != YES", HKMetadataKeyWasUserEntered];
Note that this must be formulated as value != YES
because the value for the key could be YES, NO, or nil and nil implies NO.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…