title: CMDeviceMotion yaw values unstable when iPhone is vertical
body: <p>In a iOS prototype I use a combination of CMDeviceMotion.deviceMotion.yaw and CLHeading.trueHeading to make stable compass heading that is responsive and accurate. This works well when the iPhone is held flat, where I have a graphical arrow that point to a stable compass heading. </p>
  
  <p>The problem appear when the iPhone is held vertical in portait mode. The UIDeviceOrientation constantly changes from UIDeviceOrientationFaceDown to UIDeviceOrientationFaceUp and back. This makes the yaw value to skip back and forth +/-180 degrees based on small changes of the pitch. Is it possible to lock the device to one orientation that gives a stable yaw value, predict the change without glitches or compute the gyro yaw (or roll in this orientation) in other ways?</p>
  
  <p>This poor guy have the same problem, with no answers. Double points possible people! :)
  <a href="https://stackoverflow.com/questions/10470938/euler-angle-yaw-not-working-when-iphone-orientation-changes">https://stackoverflow.com/questions/10470938/euler-angle-yaw-not-working-when-iphone-orientation-changes</a></p>