Not seeing anything for silver challenge


Im pretty sure that being on my Mac I’m not going to see a heading change, but I wanted to ensure that i’ve done it correctly before moving on:

[code]-(id)initWithNibName:(NSString *)nibNameOrNil
bundle:(NSBundle *)nibBundleOrNil
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];

if (self){
    locationManager = [[CLLocationManager alloc] init];
    [locationManager setDelegate:self];
    [locationManager setDesiredAccuracy:kCLLocationAccuracyBest];
    [locationManager setDistanceFilter:50];
    [locationManager startUpdatingLocation];
    if ([CLLocationManager headingAvailable]){
        [locationManager startUpdatingHeading];
    } else {
        NSLog(@"You do not have a compass");
return self;


And then:

-(void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading { NSLog(@"Heading: %@", newHeading); }

Is that the proper solution?

Right now I’m getting the "You don’t have a compass message to my log.


I have the same code as you do. When I use the IPhone simulator, I do not get any heading output. However, when I plug in my IPhone and launch the application there, it displays heading correctly in the console. I believe your assumption that you just don’t have a device that has a compass is correct.



Yes, guys, I got the same from google … te-compass


I know it’s an old thread - but just to confirm:

  1. Running in simulator won’t give you correct heading updates if any at all
  2. Running on an iDevice will produce correct updates

I tested this with my iPhone and used same code as above - she works perfectly. :smiley: :smiley: