我正在尝试从 Apple Watch 3(WatchOS 5.1)获取 Core Motion 数据,但尽管 DeviceMotion 可用(isDeviceMotionAvailable
属性为true
),但从未触发处理程序。解析后立即在控制台中收到以下消息super.willActivate()
:
[Gyro] 手动设置 gyro-interrupt-calibration 为 800
我正在使用以下函数来获取 Device Motion 更新:
func startQueuedUpdates() {
if motion.isDeviceMotionAvailable {
self.motion.deviceMotionUpdateInterval = 1.0 / 100.0
self.motion.showsDeviceMovementDisplay = true
self.motion.startDeviceMotionUpdates(using: .xMagneticNorthZVertical, to: self.queue, withHandler:{
(data, error) in
// Make sure the data is valid before accessing it.
if let validData = data {
print(String(validData.userAcceleration.x))
}
})
}
}
在我声明的 InterfaceController
let motion = CMMotionManager()
let queue : OperationQueue = OperationQueue.main
有没有人遇到过此消息并设法解决它?
注意:我已经检查了该isGyroAvailable
属性,它是false
.