I have this code to obtain a code country, but I want to see all code country available; then I can do some "if" to implement in my app
NSLocale *locale = [NSLocale currentLocale];
NSString *countryCode = [locale objectForKey: NSLocaleCountryCode];
NSLog(@"countryCode:%@", countryCode);
can you help me?
Run this code to see all available localizers:
You can do the same thing for
commonISOCurrencyCodes
,ISOCountryCodes
,ISOCurrencyCodes
,ISOCurrencyCodes
,preferredLanguages
.This is an array with all country codes:
Better to rely on the NSLocale for countryCode & other language/locale dependent strings. For example:
Egypt
in Russian isЕгипет
. Avoid using hardcoded country lists like https://stackoverflow.com/a/22660792/342794.Use
[NSLocale ISOCountryCodes]
.From
NSLocale.h
; look at other similar properties