I am in the process of developing an iPhone app that uses the devices X and Y CMMotionManager orientation.
When I've been testing my app on ipod touch's and iPads I've had no problems when I place the device on a level surface the X and Y attitude variables equal roughly 0.
BUT
When I tested it on an iPhone 5 the Y variable was equal to around -6 and the X about 6 on the same level surface!!
Is this an ios bug? or something wrong with my code?
Any help with this would greatly appreciated.
This is my code btw:
motion = gyroscopeManager.deviceMotion;
NSString *x = [NSString stringWithFormat:@"%f", 180 * motion.gravity.x / M_PI];
NSString *y = [NSString stringWithFormat:@"%f", 180 * motion.gravity.y / M_PI];
I found the problem! in another section of my code I had included a method that checked the devices acceleration, when I removed this method the gyroscope behaved normally!