Wednesday 25 March 2015

Programatically finding current country code and name in iOS

NSLocale *countryLocale = [NSLocale currentLocale]; 
NSString *countryCode = [countryLocale objectForKey:NSLocaleCountryCode]; 
NSString *country = [countryLocale displayNameForKey:NSLocaleCountryCode value:countryCode]; 

NSLog(@"Country Code:%@ Name:%@", countryLocale, countryCode, country); 
//Country Code:IN Name:India

No comments:

Post a Comment