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 ???