iOS地址批量编码

2018-06-11  本文已影响12人  文扉Song
 CLLocation *c = [[CLLocation alloc] initWithLatitude:39.990459 
longitude:116.481476];
    //创建位置
    CLGeocoder *revGeo = [[CLGeocoder alloc] init];
    [revGeo reverseGeocodeLocation:c
     //反向地理编码
             completionHandler:^(NSArray *placemarks, NSError *error) {
                 if (!error && [placemarks count] > 0)
                 {
                     NSDictionary *dict =
                     [[placemarks objectAtIndex:0] addressDictionary]; 
NSLog(@"street address: %@",[dict objectForKey :@"Street"]);
                 }
                 else
                 {
                     NSLog(@"ERROR: %@", error); }
             }];
上一篇 下一篇

猜你喜欢

热点阅读