Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ios下没有返回逆编码信息 #71

Open
tivjoe opened this issue May 23, 2019 · 10 comments
Open

ios下没有返回逆编码信息 #71

tivjoe opened this issue May 23, 2019 · 10 comments
Labels
bug Something isn't working ios Only for ios

Comments

@tivjoe
Copy link

tivjoe commented May 23, 2019

定位没有返回逆编码信息,设置了
setLocatingWithReGeocode(true)和setNeedAddress(true);

@tivjoe tivjoe added bug Something isn't working ios Only for ios labels May 23, 2019
@qiuxiang
Copy link
Owner

先确定返回的坐标是不是国内的

@tivjoe
Copy link
Author

tivjoe commented May 24, 2019

返回的坐标是国内的,使用Geolocation.getCurrentPosition,返回一次坐标,没有返回逆编码信息。使用watchPosition,第一次返回4次坐标信息,后2次有逆编码信息。但是需求是单次定位,在需要的时候获得一次定位信息,倾向于使用Geolocation.getCurrentPosition,但是没有返回逆编码信息,有什么解决方案吗?

@Wodezhishi321
Copy link

我之前设置了setLocatingWithReGeocode(true),然后有了code信息,然后这几天也没有了

@Wodezhishi321
Copy link

我很确定之前是有逆地理编码信息的,坐标也在国内,现在又没有了

@Wodezhishi321
Copy link

貌似是持续定位的前几次获取不到之后能取到

@qiuxiang
Copy link
Owner

单次调用确实不一定能获取到逆地理编码

@loveleiforever
Copy link

我这就获取到一次逆地理编码,怎么解决呢,急急急,确定是中国坐标

@Yieron
Copy link

Yieron commented Sep 4, 2019

目前我的解决方案是,先设置setLocatingWithReGeocode(true),然后调用Geolocation .watchPosition(),然后调用Geolocation.clearWatch() 结束监听。这样使用Geolocation.getCurrentPosition就能拿到你地址信息了。

@tvsj
Copy link

tvsj commented Feb 23, 2021

目前我的解决方案是,先设置setLocatingWithReGeocode(true),然后调用Geolocation .watchPosition(),然后调用Geolocation.clearWatch() 结束监听。这样使用Geolocation.getCurrentPosition就能拿到你地址信息了。

实测取不到地址信息,很奇怪。在调试模式下,我开启了hotloading 保存下代码后自动刷新就能拿到了,但正常调用是无论如何都拿不到的

@tvsj
Copy link

tvsj commented Feb 23, 2021

经过各种尝试,已经发现问题,是init方法异步执行导致的。将init放到应用初始化时执行,而不是每次用到定位都执行一次初始化,就能正常获取地理位置信息了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ios Only for ios
Projects
None yet
Development

No branches or pull requests

6 participants