+ (NSString*) getCountryCode
{
NSLocale *currentLocale = [NSLocale currentLocale];
NSString *countryCode = [currentLocale objectForKey:NSLocaleCountryCode];
return countryCode;
}
// output : KR
+ (NSString*) getCountryName
{
NSLocale *locale = [NSLocale currentLocale];
NSString *countryCode = [locale objectForKey: NSLocaleCountryCode];
NSLocale *usLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];
NSString *country = [usLocale displayNameForKey: NSLocaleCountryCode value: countryCode];
return country;
}
// output : South Korea
출처
https://stackoverflow.com/questions/6177309/nslocale-and-country-name/6177819
2020/08/13 - [Development Note/Android] - [Android Java] 국가코드 및 국가명 가져오기