i have trouble getting the accelerometer data from core motion manager…i followed the documentation and it still doesn’t work 🙁
self.manager = [[CMMotionManager alloc] init];
self.manager.accelerometerUpdateInterval = 0.01;
[self.manager startAccelerometerUpdates];
CMAccelerometerData *newestAccel = self.manager.accelerometerData;
int x, y, z;
x = newestAccel.acceleration.x;
y = newestAccel.acceleration.y;
z = newestAccel.acceleration.z;
any help would be very much appreciated!!
I managed to make it work using blocks, here’s the code that I managed to get working:
You can either access the accelerometerData.accelleration directly from the CAMotionManager or by creating an instance of CMAccelerometerData and assigning the variables to that. Hope this helps.