mapview中用户位置坐标的问题

时间:2011-03-25 12:22:55

标签: iphone

我正在尝试从以下代码中找到用户位置坐标:

- (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;

但它始终将位置坐标返回为:

<-180.00000000, -180.00000000> +/- 0.00m (speed -1.00 mps / course -1.00) @ 3/25/11 4:41:29 PM India Standard Time

这里有什么问题?

1 个答案:

答案 0 :(得分:1)

为了爱好所有人,请不要使用MKMapView来获取用户的位置。阅读CLLocationManager并将上述可憎的内容投射到你能找到的最深/dev/null

P.S。这些值意味着没有有效的位置数据。

相关问题