Instance Method

queryStepCountStartingFrom:to:toQueue:withHandler:

Gathers and returns historical step count data for the specified time period.

Declaration

- (void)queryStepCountStartingFrom:(NSDate *)start to:(NSDate *)end toQueue:(NSOperationQueue *)queue withHandler:(CMStepQueryHandler)handler;

Parameters

start

The start time to use when gathering step count data. This parameter must not be nil.

end

The end time to use when gathering step count data. This parameter must not be nil.

queue

The operation queue on which to execute the specified handler block. You can specify a custom queue or use the operation queue associated with your app’s main thread. This parameter must not be nil.

handler

The block to execute with the results. For information about the parameters of this block, see CMStepQueryHandler. This parameter must not be nil.

Discussion

This method runs asynchronously, returning immediately and delivering the results to the specified handler block. The system stores only the last seven days worth of step data at most. If there are no samples for the specified range of time, a value of 0 is passed to the handler block.

See Also

Getting Historical Step Counting Data

CMStepQueryHandler

A block that reports the number of steps for a query operation.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software