faça uma aplicação de bússola no iPad

Gostaria de fazer um aplicativo de bússola que especificará as direções geográficas (norte, leste, oeste, sul),

Então eu usei o framework CoreLocation na minha aplicação. Eu encontrei em muitos fóruns que quando esta função[locationManager startUpdatingHeading]; chama automaticamente chamará a função:-(void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading

Mas na minha aplicação a segunda função não é invocada automaticamente, então não consigo fazer minha aplicação, por favor me ajude ....... Meu código é dado abaixo:

-(void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading
{
    NSLog(@"New magnetic heading: %f", newHeading.magneticHeading);
    NSLog(@"New true heading: %f", newHeading.trueHeading);
    NSString *headingstring = [[NSString alloc] initWithFormat:@"%f",newHeading.trueHeading];
    trueHeading.text = headingstring;
    [headingstring release];

    NSString *magneticstring = [[NSString alloc] initWithFormat:@"%f",newHeading.magneticHeading];
    magneticHeading.text = magneticstring;
    [magneticstring release];
}

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {

    [super viewDidLoad];

    locationManager=[[CLLocationManager alloc] init];
    locationManager.desiredAccuracy = kCLLocationAccuracyBest;
    locationManager.delegate=self;
    //Start the compass updates.
    if (CLLocationManager.headingAvailable ) {     
        [locationManager startUpdatingHeading];
    }
    else {
        NSLog(@"No Heading Available: ");
        UIAlertView *noCompassAlert = [[UIAlertView alloc] initWithTitle:@"No Compass!" message:@"This device does not have the ability to measure magnetic fields." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [noCompassAlert show];
        [noCompassAlert release];
    }
}
por favor me ajud

Sreekumar Kalarikkal India

questionAnswers(2)

yourAnswerToTheQuestion