我无法得到标题信息 [英] I can't get heading information

查看:91
本文介绍了我无法得到标题信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用ios 4.3在iphone 4上获取标题信息。我已正确设置了委托,但未调用以下委托方法。关于我做错了什么想法?

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



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

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

[manager setDelegate:self];

[manager setDelegate:self];

NSLog(@我现在正在更新位置信息);

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

[manager startUpdatingHeading];

[manager startUpdatingHeading];

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

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


推荐答案

看起来像你'只告诉位置管理器你希望它在发布更新时从它调用的函数中发出更新,所以这里有一些鸡和蛋的问题。将调用移至 -setDelegate: -startUpdatingHeading 移至他们肯定会被调用的地方,例如 -viewWillAppear init 。确保代码实际上正在执行。

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.

这篇关于我无法得到标题信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆