我尝试在Swift中使用运动管理器,但我的更新块中的日志从不打印.
var motionManager: CMMotionManager = CMMotionManager()
motionManager.accelerometerUpdateInterval = 0.01
println(motionManager.deviceMotionAvailable) // print true
println(motionManager.deviceMotionActive) // print false
motionManager.startDeviceMotionUpdatesToQueue(NSOperationQueue.currentQueue(), withHandler:{
deviceManager, error in
println("Test") // no print
})
println(motionManager.deviceMotionActive) // print false
Run Code Online (Sandbox Code Playgroud)
我的Objective-C实现工作正常.有谁知道为什么我的更新块没有被调用?