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