NSLocale *currentLocale = [NSLocale currentLocale]; // get the current locale.
NSString *countryCode = [currentLocale objectForKey:NSLocaleCountryCode];
// get country code, e.g. ES (Spain), FR (France), etc.
NSLog(@"country code is:%@",countryCode);
NSString*lower=[countryCode lowercaseString];
NSString *path = [[NSBundle mainBundle] pathForResource:@"DiallingCodes" ofType:@"plist"];
NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:path];
NSMutableDictionary *_dictCountry=[[NSMutableDictionary alloc]init];
NSMutableArray *_CodeArray=[[NSMutableArray alloc]init];
[_CodeArray addObject:dict];
_dictCountry = [_CodeArray objectAtIndex:0];
NSString*Country_code=[NSString stringWithFormat:@"+%@",[_dictCountry objectForKey:lower]];
contactTextField.text=Country_code;
задан James Z 16 January 2019 в 14:24
поделиться