美文网首页
iOS地址批量编码

iOS地址批量编码

作者: 文扉Song | 来源:发表于2018-06-11 10:52 被阅读12次
 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); }
             }];

相关文章

网友评论

      本文标题:iOS地址批量编码

      本文链接:https://www.haomeiwen.com/subject/sficeftx.html