8

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
Nils Munch
  • 8,805
  • 11
  • 51
  • 103
  • The bugged devices can be found among iphone 4 and 4s alike. – Nils Munch Sep 28 '12 at 09:35
  • Have you tried checking object memory allocation/deallocation. May be there is the issue. Also check this link: http://iphonedevsdk.com/forum/iphone-sdk-development/103541-cmdevicemotion-flick-gesture.html – iCreative Oct 10 '12 at 12:58
  • Do you have the same problem when using the block based methods? – Jonathan Oct 23 '12 at 04:42

2 Answers2

6

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.

Nils Munch
  • 8,805
  • 11
  • 51
  • 103
  • 1
    What a surprise.... Another Apple bug. Sorry to hear it you wasted so much time on it. – jww Sep 01 '13 at 02:34
  • how did you solve this? i am facing the same issue and do not know what to do. i detect it and show a warning. sometimes calibrating sensors with the built in compass app helps, but sometimes not... – shelll Feb 09 '15 at 14:20
-2

Call the

[motionManager startDeviceMotionUpdatesUsingReferenceFrame:someFrame];

or

[motionManager startDeviceMotionUpdates];

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

Amit Singh
  • 428
  • 3
  • 10