Accessing Sensor Data
Core Motion provides two mechanisms for accessing sensor data. For periodic, passive access to motion data, activate the appropriate sensor (for example, startAccelerometerUpdates) and then access the data from the corresponding motion data property on the CMMotionManager object (accelerometerData).
In cases where polling is not sufficient, you can use a block-based update mechanism that executes a block that you provide for each sensor update (for example, startAccelerometerUpdatesToQueue:withHandler:). When using the handler methods, be sure to set the update interval for the sensor (accelerometerUpdateInterval). The interval is capped at minimum and maximum values, so if the actual frequency is critical to your app, make ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access