I'm trying to make an app which is similar to a compass, but with notable differences, however, they are not important. What I need to know is: how can I get the iPhone to give me the compass orientation (i.e. 0 degrees for north) regardless of the phone's orientation (i.e. It will give the same reading if it is lying flat on a table or portrait in someone's hand if it is pointing the same way)
TL;DR How can I get an iPhone's rotation around the y axis which updates every second or so.