我正在创建接收陀螺仪俯仰、滚动和偏航的测试应用程序。
此代码不起作用,因为我认为它会:
- (void) enableGyro {
motionManager.deviceMotionUpdateInterval = 1.0/30.0;
if (motionManager.gyroAvailable) {
[motionManager startGyroUpdates];
}
NSLog(@"Gyro Available? %@", (motionManager.gyroAvailable ? @"YES" : @"NO"));
NSLog(@"Gyro Active? %@", (motionManager.gyroActive ? @"YES" : @"NO"));
}
的输出是
2011-09-29 16:37:08.070 Gyro2[4014:607] Gyro Available? YES
2011-09-29 16:37:08.074 Gyro2[4014:607] Gyro Active? NO
我不明白为什么,当我开始更新陀螺仪时,它实际上并没有开始。