开发者

userLocation.coordinate gave me wrong value

开发者 https://www.devze.com 2023-04-05 10:55 出处:网络
when i try to get the current location using CLLocationCoordinate2D CurrentLocation; CurrentLocation = map.userLocation.coordinate;

when i try to get the current location using

CLLocationCoordinate2D CurrentLocation;
CurrentLocation = map.userLocation.coordinate;

i get the follwoing values:

CurrentLocation.latitude= -180.开发者_运维知识库000000;
CurrentLocation.longitude= -180.000000;

and it is not my location at all.

do you know what is missing in this?


Firstly, make sure that you have set the mapView's showUserLocation to TRUE.

Secondly, check that the value is not nil, as the mapView needs to locate the user first, and that takes a few seconds.

0

精彩评论

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