Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CMMotionManager not producing any .deviceMotions

Im working on a AR app for my company, and it is working smoothly, except on around one out of ten devices. (all iphone 4 and 4s, 5.1.1+)

When we run this code :

CMDeviceMotion *d = motionManager.deviceMotion;

    if (d == nil && motionManager.deviceMotionActive && motionManager != nil) {
        DLog(@"Device motion is active, but no device motion recieved");
    }

We get a solid block of "Device motion is active, but no device motion recieved" on some of the devices, but it seems utterly random.

If motionManager.deviceMotionActive is true, and the motion manager exists, the .deviceMotion should return a CMDeviceMotion. But it just returns nil.

Does anyone have an idea what could cause this ? The check is being run in my

- (void)onDisplayLink:(id)sender
like image 737
Nils Munch Avatar asked Sep 28 '12 08:09

Nils Munch


1 Answers

After some roaming about, we discovered that this was due to a infrequent hardware/firmware error. The wisest thing was to check for both motionManager.deviceMotion being Nil, and the motionManager.deviceMotionActive being true.

like image 170
Nils Munch Avatar answered Oct 20 '22 09:10

Nils Munch