IOS:国家代码 [英] IOS: country code

查看:143
本文介绍了IOS:国家代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这段代码来获取代码国家/地区,但我希望看到所有代码国家/地区都可用;然后我可以在我的应用程序中执行一些if

I have this code to obtain a code country, but I want to see all code country available; then I can do some "if" to implement in my app

NSLocale *locale = [NSLocale currentLocale];
NSString *countryCode = [locale objectForKey: NSLocaleCountryCode]; 
NSLog(@"countryCode:%@", countryCode);

你能帮助我吗?

推荐答案

运行此代码以查看所有可用的本地化程序:

Run this code to see all available localizers:

NSLog(@"availableLocaleIdentifiers: %@", [NSLocale availableLocaleIdentifiers]);

你可以为 commonISOCurrencyCodes 做同样的事情, ISOCountryCodes ISOCurrencyCodes ISOCurrencyCodes preferredLanguages

You can do the same thing for commonISOCurrencyCodes, ISOCountryCodes, ISOCurrencyCodes, ISOCurrencyCodes, preferredLanguages.

这篇关于IOS:国家代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆