How to get accelerometer data in IOS?

You should use the Core Motion framework (introduced in iOS 4.0) as a substitue. Create an instance of CMMotionManager and tell it to startAccelerometerUpdatesToQueue:withHandler:, passing it an NSOperationQueue and a block that will be executed on the specified queue whenever new accelerometer data is available.


It seems that UIAccelerometer and UIAccelerometerDelegate were replaced by the CoreMotion framework.

You can find the answer here:

Why is accelerometer:didAccelerate: deprecated in IOS5?

I Hope it helps.