Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c iPhone3GS是否支持阻止队列?_Objective C_Core Motion_Iphone 3gs - Fatal编程技术网

Objective c iPhone3GS是否支持阻止队列?

Objective c iPhone3GS是否支持阻止队列?,objective-c,core-motion,iphone-3gs,Objective C,Core Motion,Iphone 3gs,我在运行iOS5.0的iPhone3GS上的一些代码遇到了问题 下面的块永远不会被执行,即使它在使用iOS5.0的iPhone4上被称为fine 日志语句从未出现,断点也从未被触发。我检查了,运动管理器和队列都不是空的 [motionManager startDeviceMotionUpdatesToQueue:motionQueue withHandler:^(CMDeviceMotion *motion, NSError *error) { NSLog(@"mo

我在运行iOS5.0的iPhone3GS上的一些代码遇到了问题

下面的块永远不会被执行,即使它在使用iOS5.0的iPhone4上被称为fine

日志语句从未出现,断点也从未被触发。我检查了,运动管理器和队列都不是空的

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

            NSLog(@"motion event received");

//...
}];
我是否遗漏了什么,或者我是否需要重新编写代码以在没有块队列的情况下工作?
感谢您对ussue的任何意见

更新:

我已经检查了这个方法,它是有效的:

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

这与块队列无关。我相信您的问题在于设备运动事件需要加速计和陀螺仪(并且可以使用
-deviceMotionAvailable
查询),但iPhone 3GS没有陀螺仪。因此,即使是非基于块的设备运动方法也不适用于您。你应该看看是否加速度计本身就足以满足你的需要;否则,你将不得不限制你的应用程序需要陀螺仪