我在运行 iOS5.0 的 iPhone3GS 上的一些代码遇到了问题
以下块永远不会被执行,即使它在 iOS5.0 的 iPhone4 上被调用得很好。
日志语句永远不会出现,断点永远不会被触发。我查了一下,运动管理器和队列都不为空。
[motionManager startDeviceMotionUpdatesToQueue:motionQueue withHandler:^(CMDeviceMotion *motion, NSError *error) {
NSLog(@"motion event received");
//...
}];
我是否遗漏了什么,或者我需要重新编写代码才能在没有阻塞队列的情况下工作?
感谢您对我们的任何意见!
更新:
我检查了这个方法,它有效:
[motionManager startAccelerometerUpdatesToQueue:motionQueue withHandler:^(CMAccelerometerData *accelerometerData, NSError *error) {
NSLog(@"accelerometerData event received");
}];