如何从经度和纬度获得地址

时间:2013-06-19 07:16:34

标签: iphone geolocation cllocationmanager

我是iphone开发的新手,我想在mapview中显示地址。我目前正在使用CLLocationManager

我正在使用这种方法:

-(NSString *)getAddressFromLatLon:(double)pdblLatitude
                    withLongitude:(double)pdblLongitude
{
    NSString *urlString = [NSString stringWithFormat:kGeoCodingString,pdblLatitude, pdblLongitude];
    NSError* error;
    NSString *locationString = [NSString stringWithContentsOfURL:
                                [NSURL URLWithString:urlString]
                                                        encoding:NSASCIIStringEncoding
                                                           error:&error];
    locationString = [locationString stringByReplacingOccurrencesOfString:@"\"" withString:@""];
    NSLog(@"%@",locationString);
    return [locationString substringFromIndex:6];
}

然后我传递了这个值:

[self getAddressFromLatLon:37.484848 withLongitude:74.48489];

但是,我没有收到我的地址。

0 个答案:

没有答案