MKReverseGeocoderはdeprecated扱いで、
CoreLocationのCLGeocoderを使用すればよいみたい。
(MKReverseGeocoderはグーグルマップ使ってみたいですね)
CLGeocoder *geocoder = [CLGeocoder new]; [_geocoder reverseGeocodeLocation:location completionHandler:^(NSArray *placemarks, NSError *error) { if (error) { LOG_CURRENT_LINE(@"%@", error); } else { if (0 < [placemarks count]) { // ログ出力 CLPlacemark *p = [placemarks objectAtIndex:0]; NSString *country = [p.addressDictionary objectForKey:@"Country"]; NSString *countryCode = [p.addressDictionary objectForKey:@"CountryCode"]; NSString *name = [p.addressDictionary objectForKey:@"Name"]; NSString *state = [p.addressDictionary objectForKey:@"State"]; NSString *street = [p.addressDictionary objectForKey:@"Street"]; NSString *thoroughfare = [p.addressDictionary objectForKey:@"Thoroughfare"]; cellLabel.text = street; }else{ LOG_CURRENT_LINE(@"(取得できませんでした)"); cellLabel.text = @"(取得できませんでした)"; } } }];
0 件のコメント:
コメントを投稿