I'm trying to start the accelerometer for a game I'm making using the new Swift programming language, but it doesn't seem to work. This is my code right now:
var motionManager=CMMotionManager()
var queue=NSOperationQueue()
motionManager.accelerometerUpdateInterval = (1/40)
motionManager.startAccelerometerUpdatesToQueue(queue, withHandler {(accelerometerData:CMAccelerometerData!, error:NSError!) in
self.update(accelerometerData.acceleration)
})
I'm not getting any errors, but when I run this nothing happens (my update function isn't called). What exactly is wrong with this?