Iphone 返回Mapkit用户位置坐标

Iphone 返回Mapkit用户位置坐标,iphone,mapkit,Iphone,Mapkit,每当我试图返回我当前位置的纬度/经度坐标时,我的应用程序就会崩溃,并且不会解释错误 NSLog(@"%@", mapView.userLocation.location.coordinate); 我正在等待,直到手机也找到位置…mapView.userLocation.location.coordinate是一个结构,而%@格式说明符需要一个对象。这将有助于: NSLog(@"%f, %f", mapView.userLocation.location.coordinate.latitude,

每当我试图返回我当前位置的纬度/经度坐标时,我的应用程序就会崩溃,并且不会解释错误

NSLog(@"%@", mapView.userLocation.location.coordinate);
我正在等待,直到手机也找到位置…

mapView.userLocation.location.coordinate是一个结构,而%@格式说明符需要一个对象。这将有助于:

NSLog(@"%f, %f", mapView.userLocation.location.coordinate.latitude,
                 mapView.userLocation.location.coordinate.longitude);
mapView.userLocation.location.coordinate是一个结构,而%@格式说明符需要一个对象。这将有助于:

NSLog(@"%f, %f", mapView.userLocation.location.coordinate.latitude,
                 mapView.userLocation.location.coordinate.longitude);

出于某种原因,这对我不起作用。它把我带到坐标0.0000,0.0000。下面是我的代码,如果你有机会检查它。谢谢你的帮助

[mapView setMapType:MKMapTypeStandard];
    [mapView setZoomEnabled:YES];
    [mapView setScrollEnabled:YES];
    mapView.showsUserLocation=TRUE;

    MKCoordinateRegion region = { {0.0, 0.0 }, { 0.0, 0.0 } };

    CLLocationCoordinate2D myCoord = {mapView.userLocation.location.coordinate.latitude,mapView.userLocation.location.coordinate.longitude};
    [mapView setCenterCoordinate:myCoord animated:YES];

    region.span.longitudeDelta = 0.01f;
    region.span.latitudeDelta = 0.01f;
    [mapView setRegion:region animated:YES]; 

    [mapView setDelegate:self];

出于某种原因,这对我不起作用。它把我带到坐标0.0000,0.0000。下面是我的代码,如果你有机会检查它。谢谢你的帮助

[mapView setMapType:MKMapTypeStandard];
    [mapView setZoomEnabled:YES];
    [mapView setScrollEnabled:YES];
    mapView.showsUserLocation=TRUE;

    MKCoordinateRegion region = { {0.0, 0.0 }, { 0.0, 0.0 } };

    CLLocationCoordinate2D myCoord = {mapView.userLocation.location.coordinate.latitude,mapView.userLocation.location.coordinate.longitude};
    [mapView setCenterCoordinate:myCoord animated:YES];

    region.span.longitudeDelta = 0.01f;
    region.span.latitudeDelta = 0.01f;
    [mapView setRegion:region animated:YES]; 

    [mapView setDelegate:self];