0
我得到了经度和纬度值,我将它保存在一个标签中,它很容易显示在我的应用程序中,但我想要当前的位置详细信息,主要是该地点的名称。
我用MKReverseGeocoder。我这样做的代码我如何获得iPhone应用程序中的当前位置?
- (void)locationUpdate:(CLLocation *)location
{
CLLocationCoordinate2D coord;
coord.longitude=[NSString stringWithFormat:@"LATITUDE: %f", location.coordinate.latitude];
MKReverseGeocoder *geocoder=[[MKReverseGeocoder alloc]initWithCoordinate:coord];
[geocoder setDelegate:self];
[geocoder start];
latlbl.text = [NSString stringWithFormat:@"LATITUDE: %f", location.coordinate.latitude];
lonlbl.text = [NSString stringWithFormat:@"LONGITUDE: %f", location.coordinate.longitude];
//txtlocate.text = [location description];
}
![-(void)reverseGeocoder:(MKReverseGeocoder)geocoder didFindPlacemark:(MKPlacemark *)placemark
{
NSLog(@"%@",\[placemark addressDictionary\]
}
这是我得到的错误...
预先感谢
ü可以解释我简单地会是怎样的代码 – goku
我如何可以改变两个坐标为双? – goku
@goku他们都是双重类型,只是类型定义为CLLocationDegrees。查看答案的新版本。 :) – Kjuly