I was playing around with the deviceMotionUpdateInterval and I can't really see any change when I set it. The handler is getting called at maximum. Am I doing something wrong? Is that a bug?
var counter = 0
if (motionManager.accelerometerAvailable == true)
{
self.motionManager.deviceMotionUpdateInterval = 1
let handler:CMAccelerometerHandler = {(data: CMAccelerometerData?, error: NSError?) -> Void in
counter++
print(counter)
}
self.motionManager.startAccelerometerUpdatesToQueue(NSOperationQueue.currentQueue()!, withHandler: handler)
}
The problem is that you're setting the wrong property. The deviceMotionUpdateInterval
is for device motion updates. That's not what you've asked for; you've asked for accelerometer updates. For accelerometer updates, you would want to set the accelerometerUpdateInterval
.