We have seen how to use the magnetometer data from the Core Location Manager object before. Now we will use the Core Motion Manager to access the device's accelerometer data. For the purpose of this example, we will create a new project named
Hello Motion: Accelerometer. We will also implement both the
pull methods of getting data from the motion manager.
Hello Motion: Accelerometer, and add the Core Motion Framework from the Targets | Hello Motion: Accelerometer | Build Phases option in Xcode.
ViewController.hfile, we import the
<CoreMotion/CoreMotion.h>header file. We then declare the Motion Manager object, as well as a queue of type