0

How can I retrieve the astronomical altitude that an iOS device is pointed towards? The goal is to be able to point the devices camera at the sky and have it display the altitude.

Astronomical altitude is the angle between an object and the observer's local horizon. This is different then the altitude returned from the location manager. More info: http://en.wikipedia.org/wiki/Altitude_(astronomy)

Ander
  • 3,688
  • 1
  • 22
  • 24
Dash
  • 17,188
  • 6
  • 48
  • 49

1 Answers1

1

There is no altitude or similar returned by a CLLocationManager.

What you need is CMMotionManager.
Start a timer with the readout frequency of your choice and read the attitude of your CMMotionManager. Remember to create only one instance of CMMotionManager.

The CMAttitude object has a property called pitch which gives you the rotation around a lateral axis that passes through the device from side to side. So basically it is the same as your desired altitude.

yinkou
  • 5,756
  • 2
  • 24
  • 40