IS2Pedometer Class Reference

Inherits from NSObject
Declared in IS2Pedometer.h

Overview

IS2Pedometer provides access to the pedometer data found in the Health app bundled with iOS. Please note, due to the underlying APIs used here, this class is iOS 9+ only.

All values returned by this class are in relation to the current day.

Setup

+ registerForPedometerNotificationsWithIdentifier:andCallback:

Sets a block to be called whenever the user’s pedometer data changes. The identifier must be unique string; it is recommended to use reverse DNS notation, such as “com.foo.bar”.

+ (void)registerForPedometerNotificationsWithIdentifier:(NSString *)identifier andCallback:(void ( ^ ) ( void ))callbackBlock

Parameters

identifier

The identifier associated with your callback

callbackBlock

The block to call once data changes

Declared In

IS2Pedometer.h

+ unregisterForNotificationsWithIdentifier:

The inverse of registering for notifications. This must be called when your code is unloaded!

+ (void)unregisterForNotificationsWithIdentifier:(NSString *)identifier

Parameters

identifier

The identifier associated with your callback

Declared In

IS2Pedometer.h

Data retrieval

+ numberOfSteps

The number of steps taken by the user.

+ (int)numberOfSteps

Declared In

IS2Pedometer.h

+ distanceTravelled

The estimated distance (in meters) traveled by the user.

This value reflects the distance traveled while walking and running. The value in this property may be 0 if distance estimation is not supported on the current device.

+ (CGFloat)distanceTravelled

Declared In

IS2Pedometer.h

+ userCurrentPace

The current pace of the user, measured in seconds per meter.

This value may be 0 for devices that do not support the gathering of pace data.

+ (CGFloat)userCurrentPace

Declared In

IS2Pedometer.h

+ userCurrentCadence

The rate at which steps are taken, measured in steps per second.

This value may be 0 for devices that do not support the gathering of cadence data.

+ (CGFloat)userCurrentCadence

Declared In

IS2Pedometer.h

+ floorsAscended

The approximate number of floors ascended by walking.

This value is 0 when floor counting is not supported on the current device.

+ (int)floorsAscended

Declared In

IS2Pedometer.h

+ floorsDescended

The approximate number of floors descended by walking.

This value is 0 when floor counting is not supported on the current device.

+ (int)floorsDescended

Declared In

IS2Pedometer.h