I am using following code to get shake events in my app using coreMotion FrameWork. This code works perfectly fine in iPod 5 but not working on any other device i.e. iPhone 4, 3gs, iPod 4. I tried in iOS 6 and 5.
NSOperationQueue *op = [[NSOperationQueue alloc] init];
CMMotionManager *motionManager = [(AppDelegate *)[[UIApplication sharedApplication] delegate] sharedMotionManager];
motionManager.deviceMotionUpdateInterval = 1;
[motionManager startAccelerometerUpdatesToQueue:op withHandler:^(CMAccelerometerData *accelerometerData, NSError *error)
{
if(error)
{
NSLog(@"%@", [error localizedDescription]);
}
else
{
[self calculateWithThreshold:accelerometerData];
}
}];
Please advice what could be the problem.