姿勢の値では、デバイスのモーションの更新を次のように開始する必要があります。
startDevicemotionUpdates
デバイスが動いたときに姿勢の値を監視するには、ラベルに表示される姿勢の値を使用します。
[self.cmMotionManager startDeviceMotionUpdatesToQueue:[NSOperationQueue mainQueue] withHandler:^(CMDeviceMotion *devMotion, NSError *error) {
float pitch = (180/M_PI)*self.manager.devMotion.attitude.pitch];
float roll = (180/M_PI)*self.manager.devMotion.attitude.roll];
float yaw = (180/M_PI)*self.manager.devMotion.attitude.yaw];
self.rollLabel.text = [NSString stringWithFormat:@"%f", roll];
self.pitchLabel.text = [NSString stringWithFormat:@"%f",pitch];
self.yawLabel.text = [NSString stringWithFormat:@"%f",yaw];
}
また、ロール、ピッチ、ヨー (別名オイラー角) を使用しないことをお勧めします。精度を高めるには、Quaternion または Rotation 行列を使用します。オイラー角はジンバル ロックと呼ばれる状況になる傾向があり、データの信頼性が低下します。
クォータニオンの使用方法については、このリンクを確認し、その値をロール、ピッチ、ヨーの値に変換してください: SO リンク