开发者

iPad 1 not receiving motion updates but iPad 2 does

开发者 https://www.devze.com 2023-04-02 01:24 出处:网络
I\'m doing what I thought was the standard approach for reading the device\'s angle: motionManager = [[CMMotio开发者_如何学编程nManager alloc] init];

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

精彩评论

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