Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xcode 6.1 iOS 8.1 NSLocale displayNameForKey NSLocaleIdentifier return nil

- (NSString *)countryNameByCode:(NSString*)countryCode
{
    NSString *identifier = [NSLocale localeIdentifierFromComponents:@{NSLocaleCountryCode: countryCode}];
    NSString *countryName = [[NSLocale currentLocale] displayNameForKey:NSLocaleIdentifier value:identifier];

    return countryName;
}

This returned nil. Why?

like image 753
Yuriy Bosov Avatar asked Oct 28 '14 16:10

Yuriy Bosov


1 Answers

This is a known Apple issue for iOS 8.1 simulator only - not reproducible on 8.1 devices. See below issue description from Xcode 6.1 release notes:

Localization and Keyboard settings (including 3rd party keyboards) are not correctly honored by Safari, Maps, and developer apps in the iOS 8.1 Simulator. [NSLocale currentLocale] returns en_US and only the English and Emoji keyboards are available. (18418630, 18512161).

See Xcode 6.1 Release Notes for more details.

like image 161
Zorayr Avatar answered Oct 19 '22 22:10

Zorayr