Contents

earliestPermittedSampleDate()

Returns the earliest date that the framework permits your app to save or read samples.

Declaration

func earliestPermittedSampleDate() -> Date

Mentioned in

Return Value

The earliest date that samples can use. HealthKit doesn’t allow saving or querying samples prior to this date.

Discussion

Attempts to save samples earlier than this date fail with an HKError.Code.errorInvalidArgument error. Attempts to query samples before this date return samples after this date.

This date is a systemwide platform constraint that applies equally to all apps. It isn’t related to what the person chooses to share with your app. To determine whether the person grants your app a limited portion of their health history, use getEarliestAuthorizedSampleDate(for:completion:).

See Also

Accessing HealthKit