私は自分のプロジェクトに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);