Country name in iOS 13. NSLocale

An old code detecting the full country name fails under iOS 13 (Beta 3):

NSString *displayNameString = [[NSLocale currentLocale] displayNameForKey:NSLocaleCountryCode value:@"FR"];


displayNameString is nil.

You can check yourself this sample:

NSLocale *currentLocale = [NSLocale currentLocale];

NSString *countryCode = [currentLocale objectForKey:NSLocaleCountryCode];

NSString *displayNameString = [[NSLocale currentLocale] displayNameForKey:NSLocaleCountryCode value:countryCode];


Is it a bug in iOS? Is there another way to detect the country name?

Replies

I think I've seen this too. I was using the simulator and found that if I changed the language in the Apple Settings app and then changed it back to what I wanted, then the NSLocale methods started returning non-nil values again.


I haven't yet tested it on a real device and I assumed it was a bug in the beta.