//实现正向地理编码的回调函数
-
(void)onGeocodeSearchDone:(AMapGeocodeSearchRequest *)request response:(AMapGeocodeSearchResponse *)response
{
if(response.geocodes.count == 0)
{
return;
}//通过AMapGeocodeSearchResponse对象处理搜索结果
NSString *strCount = [NSString stringWithFormat:@"count: %d", response.count];
NSString *strGeocodes = @"";
for (AMapTip *p in response.geocodes) {
strGeocodes = [NSString stringWithFormat:@"%@\ngeocode: %@", strGeocodes, p.description];
}
NSString *result = [NSString stringWithFormat:@"%@ \n %@", strCount, strGeocodes];
NSLog(@"Geocode: %@", result);
}
这句代码。似乎不太合适。
for (AMapTip *p in response.geocodes) {
怎么解??
1000Phone の Swift 版:
func onGeocodeSearchDone(request: AMapGeocodeSearchRequest!, response: AMapGeocodeSearchResponse!) {
for p in response.geocodes {
let tip = p as! AMapGeocode
print("\(tip.location.latitude), \(tip.location.longitude)")
}
}