tags:

views:

60

answers:

1

i want to embed compass on my application can any one help me plz

- (void)viewDidLoad {

    locationManager=[[CLLocationManager alloc] init];
    locationManager.desiredAccuracy = kCLLocationAccuracyBest;
    locationManager.delegate=self;
    //Start the compass updates.
    //[self.locationManager startUpdatingHeading];
    [[self locationManager] startUpdatingHeading];

    [super viewDidLoad];
}

- (void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading
{
    NSLog(@"New magnetic heading: %f", newHeading.magneticHeading);
    NSLog(@"New true heading: %f", newHeading.trueHeading);
}

this code is not working on device its only running on simulator??? any idea ???

A: 

Use Core Location

A search on the docs for compass is not that hard...

Eiko
but do i need to use maps for that or just coreloc will do??
ram