Question

I have this strange problem. In my app I'm asking the device, if DeviceMotion is available:

if (coreMotionManager.isDeviceMotionAvailable) {

    coreMotionManager.deviceMotionUpdateInterval = 1.0 / 60.0;
    [coreMotionManager startDeviceMotionUpdates];

    [NSTimer scheduledTimerWithTimeInterval:1.0 / 60.0 target:self selector:@selector(didUpdateCoreMotion) userInfo:nil repeats:YES];
}
else {
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"NO DEVICE MOTION" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
    [alert show];
}

but it's always false... What am I doing wrong? I'm doing this on my iPad 3 and I already played around with CMMotionManager in the past and with it's .deviceMotion.attitude.roll, pitch and yaw and everything was just fine. But now I just always get alert o.O

Does anyone have an idea what can be wrong? Thx very much for any help :)

Finally restarting my Mac helped, after restart it all just worked! :) Thanks Kay for sticking around and help :)

Was it helpful?

Solution 2

Finally restarting my Mac helped, after restart it all just worked! :) Thanks Kay for sticking around and help :)

OTHER TIPS

Reset your IPad. I have had this happen to me before on an ipad 2 and an ipad 3. The device just refuses to give attitude to me. I'm guessing it is because the internal gyro gets out of whack and needs to be reset.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top