开发者

iPad 1 not receiving motion updates but iPad 2 does

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. :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜