HealthKit watchOS 8.5 to 9.0 API Differences

HKActivitySummary.h
Added HKActivitySummary.exerciseTimeGoal
Added HKActivitySummary.standHoursGoal
Modified HKActivitySummary.appleExerciseTimeGoal
Availability
FromAvailable
ToDeprecated

Modified HKActivitySummary.appleStandHoursGoal
Availability
FromAvailable
ToDeprecated

HKAttachment.h
Added HKAttachment
Added HKAttachment.identifier
Added HKAttachment.name
Added HKAttachment.contentType
Added HKAttachment.size
Added HKAttachment.creationDate
Added HKAttachment.metadata
HKAttachmentStore.h
Added HKAttachmentStore
Added -[HKAttachmentStore initWithHealthStore:]
Added -[HKAttachmentStore addAttachmentToObject:name:contentType:URL:metadata:completion:]
Added -[HKAttachmentStore removeAttachment:fromObject:completion:]
Added -[HKAttachmentStore getAttachmentsForObject:completion:]
Added -[HKAttachmentStore getDataForAttachment:completion:]
Added -[HKAttachmentStore streamDataForAttachment:dataHandler:]
HKContactsLensSpecification.h
Added HKContactsLensSpecification
Added HKContactsLensSpecification.baseCurve
Added HKContactsLensSpecification.diameter
Added -[HKContactsLensSpecification initWithSphere:cylinder:axis:addPower:baseCurve:diameter:]
HKContactsPrescription.h
Added HKContactsPrescription
Added HKContactsPrescription.rightEye
Added HKContactsPrescription.leftEye
Added HKContactsPrescription.brand
Added +[HKContactsPrescription prescriptionWithRightEyeSpecification:leftEyeSpecification:brand:dateIssued:expirationDate:device:metadata:]
HKDefines.h
Added HKCategoryValueSleepAnalysisAsleepUnspecified
Added HKCategoryValueSleepAnalysisAsleepCore
Added HKCategoryValueSleepAnalysisAsleepDeep
Added HKCategoryValueSleepAnalysisAsleepREM
Added HKCategoryValueSleepAnalysisAsleepValues()
Modified HKCategoryValueSleepAnalysisAsleep
Availability
FromAvailable
ToDeprecated

HKElectrocardiogramQuery.h
Modified HKElectrocardiogramVoltageMeasurement
Protocols
Fromnone
ToNSCopying

HKGlassesLensSpecification.h
Added HKGlassesLensSpecification
Added HKGlassesLensSpecification.vertexDistance
Added HKGlassesLensSpecification.prism
Added HKGlassesLensSpecification.farPupillaryDistance
Added HKGlassesLensSpecification.nearPupillaryDistance
Added -[HKGlassesLensSpecification initWithSphere:cylinder:axis:addPower:vertexDistance:prism:farPupillaryDistance:nearPupillaryDistance:]
HKGlassesPrescription.h
Added HKGlassesPrescription
Added HKGlassesPrescription.glassesDescription
Added HKGlassesPrescription.rightEye
Added HKGlassesPrescription.leftEye
Added +[HKGlassesPrescription prescriptionWithRightEyeSpecification:leftEyeSpecification:description:dateIssued:expirationDate:device:metadata:]
HKHealthStore.h
Added -[HKHealthStore requestPerObjectReadAuthorizationForType:predicate:completion:]
HKLensSpecification.h
Added HKLensSpecification
Added HKLensSpecification.sphere
Added HKLensSpecification.cylinder
Added HKLensSpecification.axis
Added HKLensSpecification.addPower
HKLiveWorkoutBuilder.h
Added -[HKLiveWorkoutBuilderDelegate workoutBuilder:didBeginActivity:]
Added -[HKLiveWorkoutBuilderDelegate workoutBuilder:didEndActivity:]
Added HKLiveWorkoutBuilder.currentWorkoutActivity
HKMetadata.h
Added HKMetadataKeyUserMotionContext
Added HKUserMotionContext
Added HKUserMotionContextNotSet
Added HKUserMotionContextStationary
Added HKUserMotionContextActive
Added HKMetadataKeySessionEstimate
Added HKHeartRateRecoveryTestType
Added HKHeartRateRecoveryTestTypeMaxExercise
Added HKHeartRateRecoveryTestTypePredictionSubMaxExercise
Added HKHeartRateRecoveryTestTypePredictionNonExercise
Added HKMetadataKeyHeartRateRecoveryTestType
Added HKMetadataKeyHeartRateRecoveryActivityType
Added HKMetadataKeyHeartRateRecoveryActivityDuration
Added HKMetadataKeyHeartRateRecoveryMaxObservedRecoveryHeartRate
Added HKSwimmingStrokeStyleKickboard
Added HKMetadataKeySWOLFScore
Added HKMetadataKeyQuantityClampedToLowerBound
Added HKMetadataKeyQuantityClampedToUpperBound
HKObjectType.h
Added +[HKObjectType visionPrescriptionType]
Added -[HKObjectType requiresPerObjectAuthorization]
Added HKPrescriptionType
HKQuery.h
Added +[HKQuery predicateForCategorySamplesEqualToValues:]
Added +[HKQuery predicateForWorkoutsWithOperatorType:quantityType:sumQuantity:]
Added +[HKQuery predicateForWorkoutsWithOperatorType:quantityType:minimumQuantity:]
Added +[HKQuery predicateForWorkoutsWithOperatorType:quantityType:maximumQuantity:]
Added +[HKQuery predicateForWorkoutsWithOperatorType:quantityType:averageQuantity:]
Added +[HKQuery predicateForWorkoutActivitiesWithWorkoutActivityType:]
Added +[HKQuery predicateForWorkoutActivitiesWithOperatorType:duration:]
Added +[HKQuery predicateForWorkoutActivitiesWithStartDate:endDate:options:]
Added +[HKQuery predicateForWorkoutActivitiesWithOperatorType:quantityType:sumQuantity:]
Added +[HKQuery predicateForWorkoutActivitiesWithOperatorType:quantityType:minimumQuantity:]
Added +[HKQuery predicateForWorkoutActivitiesWithOperatorType:quantityType:maximumQuantity:]
Added +[HKQuery predicateForWorkoutActivitiesWithOperatorType:quantityType:averageQuantity:]
Added +[HKQuery predicateForWorkoutsWithActivityPredicate:]
Modified +[HKQuery predicateForWorkoutsWithOperatorType:totalEnergyBurned:]
AvailabilityDeprecation Message
FromAvailablenone
ToDeprecatedUse predicateForWorkoutActivitiesWithOperatorType:quantityType:sumQuantity: passing the HKQuantityType for HKQuantityTypeIdentifierActiveEnergyBurned

Modified +[HKQuery predicateForWorkoutsWithOperatorType:totalDistance:]
AvailabilityDeprecation Message
FromAvailablenone
ToDeprecatedUse predicateForWorkoutActivitiesWithOperatorType:quantityType:sumQuantity: passing the HKQuantityType for the desired distance type

Modified +[HKQuery predicateForWorkoutsWithOperatorType:totalSwimmingStrokeCount:]
AvailabilityDeprecation Message
FromAvailablenone
ToDeprecatedUse predicateForWorkoutActivitiesWithOperatorType:quantityType:sumQuantity:

Modified +[HKQuery predicateForWorkoutsWithOperatorType:totalFlightsClimbed:]
AvailabilityDeprecation Message
FromAvailablenone
ToDeprecatedUse predicateForWorkoutActivitiesWithOperatorType:quantityType:sumQuantity: passing the HKQuantityType for HKQuantityTypeIdentifierSwimmingStrokeCount

HKTypeIdentifiers.h
Added HKQuantityTypeIdentifierRunningStrideLength
Added HKQuantityTypeIdentifierRunningVerticalOscillation
Added HKQuantityTypeIdentifierRunningGroundContactTime
Added HKQuantityTypeIdentifierRunningPower
Added HKQuantityTypeIdentifierRunningSpeed
Added HKQuantityTypeIdentifierHeartRateRecoveryOneMinute
Added HKVisionPrescriptionTypeIdentifier
HKUnit.h
Added +[HKUnit wattUnitWithMetricPrefix:]
Added +[HKUnit wattUnit]
Added +[HKUnit diopterUnit]
Added +[HKUnit prismDiopterUnit]
Added +[HKUnit radianAngleUnitWithMetricPrefix:]
Added +[HKUnit radianAngleUnit]
Added +[HKUnit degreeAngleUnit]
HKVisionPrescription.h
Added HKVisionPrescriptionType
Added HKVisionPrescriptionTypeGlasses
Added HKVisionPrescriptionTypeContacts
Added HKVisionPrescription
Added HKVisionPrescription.prescriptionType
Added HKVisionPrescription.dateIssued
Added HKVisionPrescription.expirationDate
Added +[HKVisionPrescription prescriptionWithType:dateIssued:expirationDate:device:metadata:]
HKVisionPrism.h
Added HKPrismBase
Added HKPrismBaseNone
Added HKPrismBaseUp
Added HKPrismBaseDown
Added HKPrismBaseIn
Added HKPrismBaseOut
Added HKVisionEye
Added HKVisionEyeLeft
Added HKVisionEyeRight
Added HKVisionPrism
Added HKVisionPrism.amount
Added HKVisionPrism.angle
Added HKVisionPrism.verticalAmount
Added HKVisionPrism.horizontalAmount
Added HKVisionPrism.verticalBase
Added HKVisionPrism.horizontalBase
Added HKVisionPrism.eye
Added -[HKVisionPrism initWithAmount:angle:eye:]
Added -[HKVisionPrism initWithVerticalAmount:verticalBase:horizontalAmount:horizontalBase:eye:]
HKWorkout.h
Added HKWorkoutActivityTypeSwimBikeRun
Added HKWorkoutActivityTypeTransition
Added HKWorkout.workoutActivities
Added HKWorkout.allStatistics
Added -[HKWorkout statisticsForType:]
Added HKPredicateKeyPathWorkoutSumQuantity
Added HKPredicateKeyPathWorkoutMinimumQuantity
Added HKPredicateKeyPathWorkoutMaximumQuantity
Added HKPredicateKeyPathWorkoutAverageQuantity
Added HKPredicateKeyPathWorkoutActivity
Modified HKWorkout.totalEnergyBurned
AvailabilityDeprecation Message
FromAvailablenone
ToDeprecatedUse statisticsForType: passing the HKQuantityType for HKQuantityTypeIdentifierActiveEnergyBurned

Modified HKWorkout.totalDistance
AvailabilityDeprecation Message
FromAvailablenone
ToDeprecatedUse statisticsForType: passing the HKQuantityType for the desired distance type

Modified HKWorkout.totalSwimmingStrokeCount
AvailabilityDeprecation Message
FromAvailablenone
ToDeprecatedUse statisticsForType: passing the HKQuantityType for HKQuantityTypeIdentifierSwimmingStrokeCount

Modified HKWorkout.totalFlightsClimbed
AvailabilityDeprecation Message
FromAvailablenone
ToDeprecatedUse statisticsForType: passing the HKQuantityType for HKQuantityTypeIdentifierFlightClimbed

HKWorkoutActivity.h
Added HKWorkoutActivity
Added HKWorkoutActivity.UUID
Added HKWorkoutActivity.workoutConfiguration
Added HKWorkoutActivity.startDate
Added HKWorkoutActivity.endDate
Added HKWorkoutActivity.metadata
Added HKWorkoutActivity.duration
Added HKWorkoutActivity.workoutEvents
Added HKWorkoutActivity.allStatistics
Added -[HKWorkoutActivity statisticsForType:]
Added -[HKWorkoutActivity initWithWorkoutConfiguration:startDate:endDate:metadata:]
Added HKPredicateKeyPathWorkoutActivityType
Added HKPredicateKeyPathWorkoutActivityDuration
Added HKPredicateKeyPathWorkoutActivityStartDate
Added HKPredicateKeyPathWorkoutActivityEndDate
Added HKPredicateKeyPathWorkoutActivitySumQuantity
Added HKPredicateKeyPathWorkoutActivityMinimumQuantity
Added HKPredicateKeyPathWorkoutActivityMaximumQuantity
Added HKPredicateKeyPathWorkoutActivityAverageQuantity
HKWorkoutBuilder.h
Added HKWorkoutBuilder.workoutActivities
Added HKWorkoutBuilder.allStatistics
Added -[HKWorkoutBuilder addWorkoutActivity:completion:]
Added -[HKWorkoutBuilder updateActivityWithUUID:endDate:completion:]
Added -[HKWorkoutBuilder updateActivityWithUUID:addMedatata:completion:]
HKWorkoutRouteQuery.h
Added -[HKWorkoutRouteQuery initWithRoute:dateInterval:dataHandler:]
HKWorkoutSession.h
Added HKWorkoutSession.currentActivity
Added -[HKWorkoutSession beginNewActivityWithConfiguration:date:metadata:]
Added -[HKWorkoutSession endCurrentActivityOnDate:]
Added -[HKWorkoutSessionDelegate workoutSession:didBeginActivityWithConfiguration:date:]
Added -[HKWorkoutSessionDelegate workoutSession:didEndActivityWithConfiguration:date:]