目前使用 Apple Watch 来计算其偏航角、俯仰角和滚动角。
但是,当尝试使用 Core Motion 功能时,应用程序会崩溃。有没有人遇到过这个问题?
if motionManager.deviceMotionAvailable{
self.referenceAttitude = self.deviceMotionManger.attitude
let currentAttitude : CMAttitude = self.deviceMotionManger.attitude
currentAttitude.multiplyByInverseOfAttitude(self.referenceAttitude)
self.Yaw.setText( "Yaw " + String(format: "%.1f", currentAttitude.yaw))
self.Pitch.setText( "Pitch " + String(format: "%.1f", currentAttitude.pitch))
self.Roll.setText("Roll " + String(format: "%.1f", currentAttitude.roll) )
}
else {
self.Yaw.setText("device motion is not" + String(motionManager.deviceMotionActive))
}