O'Reilly logo

iPhone Location Aware Apps by Example by Zeeshan Chawdhary

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action — using MotionManager: accelerometer

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 push and pull methods of getting data from the motion manager.

  1. Create a new project titled Hello Motion: Accelerometer , and add the Core Motion Framework from the Targets | Hello Motion: Accelerometer | Build Phases option in Xcode.
  2. In our ViewController.h file, we import the<CoreMotion/CoreMotion.h> header file. We then declare the Motion Manager object, as well as a queue of type NSOperationQueue ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required