Question

I'm running into a problem with some of my code on iPhone3GS running iOS5.0

The following block never gets executed, even though it gets called fine on iPhone4 with iOS5.0.

The log statement never appears, and the breakpoint never gets triggered. I checked, and both the motion manager and the queue are not null.

  [motionManager startDeviceMotionUpdatesToQueue:motionQueue withHandler:^(CMDeviceMotion *motion, NSError *error) {

            NSLog(@"motion event received");

//...
}];

Am I missing something or do I need to re-write my code to work without block queues?
Thank you for any input on the ussue!

Update:

I've checked this method, and it works:

   [motionManager startAccelerometerUpdatesToQueue:motionQueue withHandler:^(CMAccelerometerData *accelerometerData, NSError *error) {
        NSLog(@"accelerometerData event received");
    }];
Was it helpful?

Solution

This has nothing to do with block queues. I believe your problem is the device motion events require both accelerometer and gyroscope (and can be queried with -deviceMotionAvailable), but the iPhone 3GS doesn't have a gyroscope. So even the non-block-based device motion methods won't work for you. You should look into seeing if the accelerometer alone is sufficient for your needs; otherwise you'll have to restrict your app to require a gyroscope.

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