Type Alias

CMDeviceMotionHandler

The type of block callback for handling device-motion data.

Declaration

typedef void (^CMDeviceMotionHandler)(CMDeviceMotion *motion, NSError *error);

Discussion

Blocks of type CMDeviceMotionHandler are called when there is device-motion data to process. You pass the block into startDeviceMotionUpdatesToQueue:withHandler: as the second argument. Blocks of this type return no value but take two arguments:

motion

A CMDeviceMotion object, which encapsulates other objects and a structure representing attitude, rotation rate, gravity, and user acceleration.

error

An error object representing an error encountered in providing gyroscope data. If an error occurs, you should stop gyroscope updates and inform the user of the problem. If there is no error, this argument is nil. Core Motion errors are of the CMErrorDomain domain and the CMError type.

See Also

Managing Device Motion Updates

showsDeviceMovementDisplay

Controls whether the device-movement display is shown.

deviceMotionUpdateInterval

The interval, in seconds, for providing device-motion updates to the block handler.

- startDeviceMotionUpdatesUsingReferenceFrame:toQueue:withHandler:

Starts device-motion updates on an operation queue and using a specified reference frame and block handler.

- startDeviceMotionUpdatesToQueue:withHandler:

Starts device-motion updates on an operation queue and using a specified block handler.

- startDeviceMotionUpdatesUsingReferenceFrame:

Starts device-motion updates using a reference frame but without a block handler.

- startDeviceMotionUpdates

Starts device-motion updates without a block handler.

- stopDeviceMotionUpdates

Stops device-motion updates.

deviceMotion

The latest sample of device-motion data.