我已将 mapkit 框架集成到我的项目中,一切正常。我只是在地图中显示用户的当前位置,如下所示:
mapView.delegate = self;
mapView.showsUserLocation = YES;
MKUserLocation *userLocation = mapView.userLocation;
//numbers show map zoom. 500,500 = map stretches 500 meters to the North and the South of current location
MKCoordinateRegion region =
MKCoordinateRegionMakeWithDistance (userLocation.location.coordinate,1000,1000);
[mapView setRegion:region animated:NO];
问题是我需要将当前位置的纬度和经度存储到 2 个变量中,但是这些值存储在哪里?
我试图打印以下内容,但它给了我 0.000。
NSLog(@"Latitude: %f" , mapView.userLocation.coordinate.latitude);
NSLog(@"Longitude: %f" , mapView.userLocation.coordinate.latitude);