Данные с гироскопа не работают на Apple Watch - PullRequest
0 голосов
/ 16 мая 2018

Этот код с акселерометром отлично работает на Apple Watch

if motionManager.isDeviceMotionAvailable {
            motionManager.deviceMotionUpdateInterval = 0.2
            motionManager.startDeviceMotionUpdates(to: OperationQueue.current!) { (data, error) in
                if data!.userAcceleration.z < -0.5 {
                    self.myOutlet.setBackgroundColor(UIColor.red)
                    self.myLabel.setText("Green")
                } else if data!.userAcceleration.z > 0.5 {
                    self.myOutlet.setBackgroundColor(UIColor.green)
                    self.myLabel.setText("Red")
                }

Но если я пытаюсь использовать гироскоп

if motionManager.isGyroAvailable {
            motionManager.gyroUpdateInterval = 0.2
            motionManager.startGyroUpdates(to: OperationQueue.current!) { (data, error) in
                if data!.rotationRate.y > 0.1 {
                    self.counter.addOne()
                    self.myLabel.setText("\(self.counter.toString())")
                }
            }
        }

, они никак не реагируют :( Apple,Часы не поддерживают доступ к гироскопу или я что-то не так делаю?

...