I am using NSLocale to determine my c开发者_Python百科urrent country and then pass it as an argument to my web service but i can't test other countries such as Africa etc. through this. Is there a way to test this? I am doing this to get the country name:
NSLocale *locale = [NSLocale currentLocale];
NSString *countryCode = [locale objectForKey: NSLocaleCountryCode];
NSString *countryName = [locale displayNameForKey: NSLocaleCountryCode value: countryCode];
Thanks,
From the NSLocale class reference
[NSLocale availableLocaleIdentifiers] returns an NSArray of strings of locales the device understands. Each of these can be passed to [[NSLocale alloc] initWithLocaleIdentifier:aString] to give you a locale to test with.
精彩评论