我正在使用此代码获取国家/地区列表:
for (NSString *code in [NSLocale ISOCountryCodes])
{
NSString *identifier = [NSLocale localeIdentifierFromComponents:@{NSLocaleCountryCode: code}];
NSString *countryName = [[NSLocale currentLocale] displayNameForKey:NSLocaleIdentifier value:identifier];
NSLog(countryName);
}
Run Code Online (Sandbox Code Playgroud)
这在iOS 7.x中运行良好,但在iOS8(beta 2)中失败 - countryName始终为零.
有人找到了另类吗?
| 归档时间: |
|
| 查看次数: |
919 次 |
| 最近记录: |