I am trying to find the user location coordinate from following code:
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
{
MKAnnotationView* newAnnotation = [[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"annotation1"];
if (annotation == _mapView.userLocation)
return nil;
CLLocationCoordinate2D location3 = annotation.coordinate;
CLLocationCoordinate2D location4 = _mapView.userLocation.coordinate;
But it is always returning location coordinate as:
<-180.00000000, -180.00000000> +/- 0.00m (speed -1.00 mps / course -1.00) @ 3/25/11 4:41:29 PM India Standard Time
What's the problem here?
For the love of all that is good, don't get the user's location using MKMapView
. Read up on CLLocationManager
and cast the above abomination into the deepest /dev/null
you can find.
PS Those values mean there is no valid location data.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.