Step Count
stepCount in Apple HealthKit. Check what the API exposes and what to look for when this data is missing or differs between apps.
API contract
- Identifier
stepCount- Type family
- quantity
- Documented unit or dimension
- Count
- Identifier introduced
- iOS 8.0
- Documented value style
- cumulative
Look up the type in Swift
Use the identifier with an SDK and OS supporting this type. Check that HealthKit is available and configure authorization in your app before requesting access.
import HealthKit
let type = HKObjectType.quantityType(forIdentifier: .stepCount)What to check when the value is missing
Use a defined interval for a total and check sample sources before combining exports. Compare the same boundaries when investigating differences across apps.
An empty query can mean your read access is limited, the writer used another type or the selected time window contains no matching data. Start with an entry of a known date and check the corresponding type in the Health app.
Use supported devices and authorized data for verification. The API contract alone does not establish which third-party apps write this type.
Compare with Health Connect
Steps StepsRecord
Both APIs represent step counts over time. Compare the same time window and data origins. On Android, use the platform aggregate for a total and the raw records to diagnose overlapping writers.
Steps Cadence StepsCadenceRecord
Cadence is a rate. Apple step count is an amount for a time interval. Converting cadence to counts requires knowing the duration and coverage of each sampled segment.
More in Activity and exercise
API documentation checked . Examples are developer starting points based on the published API.