Post

Replies

Boosts

Views

Activity

stopDeviceMotionUpdates doesn't stop motion updates
I am new to Swift development. I am building my first WatchOS app that collects motion data. I am collecting motion data using startDeviceMotionUpdates with handler. However stopDeviceMotionUpdates doesn't stop the updates and handler goes in endless loop. class WatchMotionManager: ObservableObject {     let motion = CMMotionManager()     let queue = OperationQueue()     func startQueuedUpdates() {         motion.deviceMotionUpdateInterval = 1.0 / 50.0         motion.showsDeviceMovementDisplay = true         motion.startDeviceMotionUpdates(to: self.queue, withHandler: { (data, error) in                 if let motionData = data {                     //get data                  }         })     }          func stopQueuedUpdates() {     self.motion.stopDeviceMotionUpdates()     } }```
2
0
691
Sep ’21