2017-01-31 14 views

答えて

0

あなたはハンドラでstartDeviceMotionUpdatesを使用することができます

let manager: CMMotionManager = CMMotionManager() 
manager.startDeviceMotionUpdates(to: OperationQueue.main) { (data: CMDeviceMotion?, error: Error?) in 
    if error != nil{ 
     print(error!) 
    } 
    else if data != nil{ 
     print(data!.rotationRate.x) 
     print(data!.rotationRate.y) 
     print(data!.rotationRate.z) 
     self.runMethod(motionData: data!) 
    } 
} 
関連する問題