Question

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
Était-ce utile?

La solution

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.

Autres conseils

Call the

[motionManager startDeviceMotionUpdatesUsingReferenceFrame:someFrame];

or

[motionManager startDeviceMotionUpdates];

method to begin updates and periodically access CMDeviceMotion objects by reading the deviceMotion property.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top