how to localize address result from reverseGeocodeLocation?

前端 未结 4 1369
孤独总比滥情好
孤独总比滥情好 2021-01-31 09:55

My iphone app supposed to resolve address based on latitude and longitude of the user. reverseGeocodeLocation works fine, but results are in english.

Is there a way to l

4条回答
  •  盖世英雄少女心
    2021-01-31 10:16

    i found how to localize country name, maybe it'll help:

    CLPlacemark *placemark;
    
    NSString *identifier = [NSLocale localeIdentifierFromComponents: [NSDictionary dictionaryWithObject: placemark.ISOcountryCode forKey: NSLocaleCountryCode]];
    NSLocale *usLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];
    NSString *country = [usLocale displayNameForKey: NSLocaleIdentifier value: identifier];
    

    insert any country id instead @"en_US"

提交回复
热议问题