How can I get the longitude, and latitude of the current position showing on the mapView?
Thanks.
How can I get the longitude, and latitude of the current position showing on the mapView?
Thanks.
Current window position:
float latitude = myMapView.centerCoordinate.latitude;
float longitude = myMapView.centerCoordinate.longitude;
Current user position:
CLLocation userLocation = myMapView.userLocation.location;
float latitude = userLocation.coordinate.latitude;
float longitude = userLocation.coordinate.latitude;
The map userLocation will not be set right away, often it's better to just use Core Location if you need to get the users location. After all if the map is already using the GPS, using Core Location is kind of free in that you are using no more power than the map does - you can still have the map display the users location too.
That will also tell you things like "GPS is not working" or "GPS is not available" which you can't find out from Mapkit.