Get country code from country name in IOS

Jef’s answer helped here, with slight additions. NSArray *countryCodes = [NSLocale ISOCountryCodes]; NSMutableArray *countries = [NSMutableArray arrayWithCapacity:[countryCodes count]]; for (NSString *countryCode in countryCodes) { NSString *identifier = [NSLocale localeIdentifierFromComponents: [NSDictionary dictionaryWithObject: countryCode forKey: NSLocaleCountryCode]]; NSString *country = [[[NSLocale alloc] initWithLocaleIdentifier:@”en_UK”] displayNameForKey: NSLocaleIdentifier value: identifier]; [countries addObject: country]; } NSDictionary *codeForCountryDictionary = [[NSDictionary alloc] initWithObjects:countryCodes forKeys:countries]; … Read more