开发者

I can't get heading information

I'm trying to get heading information using ios 4.3 on an iphone 4. I have my dele开发者_JAVA百科gate set correctly but the following delegate method is not being called. Any ideas on what I'm doing wrong?

  • (void)locationManager:(CLLocationManager *)manager didUpdateHeading: (CLHeading )newHeading)newHeading {

    [manager setDelegate:self];

    NSLog(@" I'm updating the location information now");

    [manager startUpdatingHeading];

    NSLog(@" heading info %@",newHeading); }


It looks like you're only telling the Location Manager that you want it to issue updates from within the function it calls when it issues updates, so there's a bit of a chicken-and-egg problem here. Move the calls to -setDelegate: and -startUpdatingHeading to someplace where they're sure to get called, like -viewWillAppear or init. Make sure that the code is actually being executed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜