I'm doing what I thought was the standard approach for reading the device's angle:
motionManager = [[CMMotio开发者_如何学编程nManager alloc] init];
if (!motionManager.deviceMotionAvailable)
return NO;
[motionManager startDeviceMotionUpdates];
And then later:
CMDeviceMotion *deviceMotion = [motionManager deviceMotion];
if (deviceMotion) {
CMAttitude *attitude = deviceMotion.attitude;
if (attitude) {
// yay
}
}
This code works fine on the iPad 2 but not on the iPad 1.
What could be wrong here?
iPad 1 doesn't have a gyro. It was introduced in 2. That might have something to do with it. :)
精彩评论