title: Compass True Heading in iPhone/iPad
body: <p>I having some problem on the iPhone/iPad compass development. </p>
  
  <p>The trueHeading taken from the CLHeading alway give me the '-1' value, I'm stuck here. Here is my code:</p>
  
  <pre><code>self.locationManager = [[[CLLocationManager alloc] init] autorelease];
  self.locationManager.desiredAccuracy = kCLLocationAccuracyBest;
  self.locationManager.delegate = self;
  self.locationManager.headingFilter = 0.5; //1 degrees
  [self.locationManager startUpdatingHeading];
  </code></pre>
  
  <p>I also found out something, that is when I on the map app or the compass app which has use the location stuff, the trueHeading value suddenly read correct. I wonder what is the cause, any idea? It happen on both iPhone4 and on the iPad. </p>
  
  <p>It also happen whenever I off the Location Services in settings and re-enable it, it will become unable to read the correct trueHeading value, i wonder because the location services cannot be enable by the app I creating?</p>
  
  <p>anyway, thank in advance</p>
  
  <p><strong>---My Solution---</strong></p>
  
  <p>see below.</p>