0
저는 Rubymotion에서 장치의 회전을 얻으려고합니다. 이 코드를 viewDidLoad에 추가했습니다.CoreMotion이 rubymotion에서 작동하지 않습니다.
@motionManager = CMMotionManager.alloc.init
@motionManager.deviceMotionUpdateInterval = 1.0
if (@motionManager.isDeviceMotionAvailable)
queue = NSOperationQueue.currentQueue
@motionManager.startDeviceMotionUpdatesToQueue(queue, withHandler:lambda do |motion, error|
NSLog "error = %@", error
NSLog "rotation rate = [%f, %f, %f]", motion.rotationRate.x, motion.rotationRate.y, motion.rotationRate.z
end)
else
NSLog "Device Motion is not available: You're likely running this in a simulator"
end
그러나 항상이 기록합니다
rotation rate = [0.000000, 0.000000, 0.000000]
내가 뭘 잘못 무엇입니까? RubyMotion에서
오 마이! 나는 오늘 밤 그것을 시도하고 해결 된 것으로 표시 할 것입니다. – Pasta