【发布时间】:2019-02-18 13:53:33
【问题描述】:
我正在尝试从 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。
【问题讨论】:
标签: gyroscope core-motion watchos-5