I managed to get it to work using blocks, here is the code I managed to get:
NSOperationQueue *theQueue = [[NSOperationQueue alloc] init]; _returnedData = [[CMAccelerometerData alloc] init]; _motionManager = [[CMMotionManager alloc] init]; [_motionManager startAccelerometerUpdatesToQueue:theQueue withHandler:^(CMAccelerometerData *accelerometerData, NSError *error) { _returnedData = _motionManager.accelerometerData; int x = _motionManager.accelerometerData.acceleration.x; int y = _returnedData.acceleration.y; NSLog(@"X: %i, Y: %i", x, y); }];
You can either access the Data.accelleration accelerator directly from the CAMotionManager, or create an instance of CMAccelerometerData and assign variables to it. Hope this helps.
source share