我正在寻找可能在 plist 文件或 Objective-C 字典中可用的国家列表及其拨号代码。
我知道 PHP 中有一些这样的列表: https ://gist.github.com/260468 如果涉及到它,我会手动移植它,但这很容易出错。
我正在寻找可能在 plist 文件或 Objective-C 字典中可用的国家列表及其拨号代码。
我知道 PHP 中有一些这样的列表: https ://gist.github.com/260468 如果涉及到它,我会手动移植它,但这很容易出错。
很简单。在vim中打开PHP版本,输入一条命令,清理标签和分隔符。
:%s/.*= \='\(.*\) (\(+\=.*\))';.*/@"\1" : @"\2",
这就是为什么每个人都应该学习vim。
(新的对象文字语法 - 需要 XCode 4.5/clang 4.1)。
转换后的列表,以防止链接腐烂:
// Country code
NSDictionary *codes = @{
@"Canada" : @"+1",
@"China" : @"+86",
@"France" : @"+33",
@"Germany" : @"+49",
@"India" : @"+91",
@"Japan" : @"+81",
@"Pakistan" : @"+92",
@"United Kingdom" : @"+44",
@"United States" : @"+1",
@"Abkhazia" : @"+7 840",
@"Abkhazia" : @"+7 940",
@"Afghanistan" : @"+93",
@"Albania" : @"+355",
@"Algeria" : @"+213",
@"American Samoa" : @"+1 684",
@"Andorra" : @"+376",
@"Angola" : @"+244",
@"Anguilla" : @"+1 264",
@"Antigua and Barbuda" : @"+1 268",
@"Argentina" : @"+54",
@"Armenia" : @"+374",
@"Aruba" : @"+297",
@"Ascension" : @"+247",
@"Australia" : @"+61",
@"Australian External Territories" : @"+672",
@"Austria" : @"+43",
@"Azerbaijan" : @"+994",
@"Bahamas" : @"+1 242",
@"Bahrain" : @"+973",
@"Bangladesh" : @"+880",
@"Barbados" : @"+1 246",
@"Barbuda" : @"+1 268",
@"Belarus" : @"+375",
@"Belgium" : @"+32",
@"Belize" : @"+501",
@"Benin" : @"+229",
@"Bermuda" : @"+1 441",
@"Bhutan" : @"+975",
@"Bolivia" : @"+591",
@"Bosnia and Herzegovina" : @"+387",
@"Botswana" : @"+267",
@"Brazil" : @"+55",
@"British Indian Ocean Territory" : @"+246",
@"British Virgin Islands" : @"+1 284",
@"Brunei" : @"+673",
@"Bulgaria" : @"+359",
@"Burkina Faso" : @"+226",
@"Burundi" : @"+257",
@"Cambodia" : @"+855",
@"Cameroon" : @"+237",
@"Canada" : @"+1",
@"Cape Verde" : @"+238",
@"Cayman Islands" : @"+ 345",
@"Central African Republic" : @"+236",
@"Chad" : @"+235",
@"Chile" : @"+56",
@"China" : @"+86",
@"Christmas Island" : @"+61",
@"Cocos-Keeling Islands" : @"+61",
@"Colombia" : @"+57",
@"Comoros" : @"+269",
@"Congo" : @"+242",
@"Congo, Dem. Rep. of (Zaire)" : @"+243",
@"Cook Islands" : @"+682",
@"Costa Rica" : @"+506",
@"Ivory Coast" : @"+225",
@"Croatia" : @"+385",
@"Cuba" : @"+53",
@"Curacao" : @"+599",
@"Cyprus" : @"+537",
@"Czech Republic" : @"+420",
@"Denmark" : @"+45",
@"Diego Garcia" : @"+246",
@"Djibouti" : @"+253",
@"Dominica" : @"+1 767",
@"Dominican Republic" : @"+1 809",
@"Dominican Republic" : @"+1 829",
@"Dominican Republic" : @"+1 849",
@"East Timor" : @"+670",
@"Easter Island" : @"+56",
@"Ecuador" : @"+593",
@"Egypt" : @"+20",
@"El Salvador" : @"+503",
@"Equatorial Guinea" : @"+240",
@"Eritrea" : @"+291",
@"Estonia" : @"+372",
@"Ethiopia" : @"+251",
@"Falkland Islands" : @"+500",
@"Faroe Islands" : @"+298",
@"Fiji" : @"+679",
@"Finland" : @"+358",
@"France" : @"+33",
@"French Antilles" : @"+596",
@"French Guiana" : @"+594",
@"French Polynesia" : @"+689",
@"Gabon" : @"+241",
@"Gambia" : @"+220",
@"Georgia" : @"+995",
@"Germany" : @"+49",
@"Ghana" : @"+233",
@"Gibraltar" : @"+350",
@"Greece" : @"+30",
@"Greenland" : @"+299",
@"Grenada" : @"+1 473",
@"Guadeloupe" : @"+590",
@"Guam" : @"+1 671",
@"Guatemala" : @"+502",
@"Guinea" : @"+224",
@"Guinea-Bissau" : @"+245",
@"Guyana" : @"+595",
@"Haiti" : @"+509",
@"Honduras" : @"+504",
@"Hong Kong SAR China" : @"+852",
@"Hungary" : @"+36",
@"Iceland" : @"+354",
@"India" : @"+91",
@"Indonesia" : @"+62",
@"Iran" : @"+98",
@"Iraq" : @"+964",
@"Ireland" : @"+353",
@"Israel" : @"+972",
@"Italy" : @"+39",
@"Jamaica" : @"+1 876",
@"Japan" : @"+81",
@"Jordan" : @"+962",
@"Kazakhstan" : @"+7 7",
@"Kenya" : @"+254",
@"Kiribati" : @"+686",
@"North Korea" : @"+850",
@"South Korea" : @"+82",
@"Kuwait" : @"+965",
@"Kyrgyzstan" : @"+996",
@"Laos" : @"+856",
@"Latvia" : @"+371",
@"Lebanon" : @"+961",
@"Lesotho" : @"+266",
@"Liberia" : @"+231",
@"Libya" : @"+218",
@"Liechtenstein" : @"+423",
@"Lithuania" : @"+370",
@"Luxembourg" : @"+352",
@"Macau SAR China" : @"+853",
@"Macedonia" : @"+389",
@"Madagascar" : @"+261",
@"Malawi" : @"+265",
@"Malaysia" : @"+60",
@"Maldives" : @"+960",
@"Mali" : @"+223",
@"Malta" : @"+356",
@"Marshall Islands" : @"+692",
@"Martinique" : @"+596",
@"Mauritania" : @"+222",
@"Mauritius" : @"+230",
@"Mayotte" : @"+262",
@"Mexico" : @"+52",
@"Micronesia" : @"+691",
@"Midway Island" : @"+1 808",
@"Micronesia" : @"+691",
@"Moldova" : @"+373",
@"Monaco" : @"+377",
@"Mongolia" : @"+976",
@"Montenegro" : @"+382",
@"Montserrat" : @"+1664",
@"Morocco" : @"+212",
@"Myanmar" : @"+95",
@"Namibia" : @"+264",
@"Nauru" : @"+674",
@"Nepal" : @"+977",
@"Netherlands" : @"+31",
@"Netherlands Antilles" : @"+599",
@"Nevis" : @"+1 869",
@"New Caledonia" : @"+687",
@"New Zealand" : @"+64",
@"Nicaragua" : @"+505",
@"Niger" : @"+227",
@"Nigeria" : @"+234",
@"Niue" : @"+683",
@"Norfolk Island" : @"+672",
@"Northern Mariana Islands" : @"+1 670",
@"Norway" : @"+47",
@"Oman" : @"+968",
@"Pakistan" : @"+92",
@"Palau" : @"+680",
@"Palestinian Territory" : @"+970",
@"Panama" : @"+507",
@"Papua New Guinea" : @"+675",
@"Paraguay" : @"+595",
@"Peru" : @"+51",
@"Philippines" : @"+63",
@"Poland" : @"+48",
@"Portugal" : @"+351",
@"Puerto Rico" : @"+1 787",
@"Puerto Rico" : @"+1 939",
@"Qatar" : @"+974",
@"Reunion" : @"+262",
@"Romania" : @"+40",
@"Russia" : @"+7",
@"Rwanda" : @"+250",
@"Samoa" : @"+685",
@"San Marino" : @"+378",
@"Saudi Arabia" : @"+966",
@"Senegal" : @"+221",
@"Serbia" : @"+381",
@"Seychelles" : @"+248",
@"Sierra Leone" : @"+232",
@"Singapore" : @"+65",
@"Slovakia" : @"+421",
@"Slovenia" : @"+386",
@"Solomon Islands" : @"+677",
@"South Africa" : @"+27",
@"South Georgia and the South Sandwich Islands" : @"+500",
@"Spain" : @"+34",
@"Sri Lanka" : @"+94",
@"Sudan" : @"+249",
@"Suriname" : @"+597",
@"Swaziland" : @"+268",
@"Sweden" : @"+46",
@"Switzerland" : @"+41",
@"Syria" : @"+963",
@"Taiwan" : @"+886",
@"Tajikistan" : @"+992",
@"Tanzania" : @"+255",
@"Thailand" : @"+66",
@"Timor Leste" : @"+670",
@"Togo" : @"+228",
@"Tokelau" : @"+690",
@"Tonga" : @"+676",
@"Trinidad and Tobago" : @"+1 868",
@"Tunisia" : @"+216",
@"Turkey" : @"+90",
@"Turkmenistan" : @"+993",
@"Turks and Caicos Islands" : @"+1 649",
@"Tuvalu" : @"+688",
@"Uganda" : @"+256",
@"Ukraine" : @"+380",
@"United Arab Emirates" : @"+971",
@"United Kingdom" : @"+44",
@"United States" : @"+1",
@"Uruguay" : @"+598",
@"U.S. Virgin Islands" : @"+1 340",
@"Uzbekistan" : @"+998",
@"Vanuatu" : @"+678",
@"Venezuela" : @"+58",
@"Vietnam" : @"+84",
@"Wake Island" : @"+1 808",
@"Wallis and Futuna" : @"+681",
@"Yemen" : @"+967",
@"Zambia" : @"+260",
@"Zanzibar" : @"+255",
@"Zimbabwe" : @"+263"
};
NSDictionary *dictCodes = [NSDictionary dictionaryWithObjectsAndKeys:
@"93",@"AF",@"355",@"AL",@"213",@"DZ",@"1",@"AS",
@"376",@"AD",@"244",@"AO",@"1",@"AI",@"1",@"AG",
@"54",@"AR",@"374",@"AM",@"297",@"AW",@"61",@"AU",
@"43",@"AT",@"994",@"AZ",@"1",@"BS",@"973",@"BH",
@"880",@"BD",@"1",@"BB",@"375",@"BY",@"32",@"BE",
@"501",@"BZ",@"229",@"BJ",@"1",@"BM",@"975",@"BT",
@"387",@"BA",@"267",@"BW",@"55",@"BR",@"246",@"IO",
@"359",@"BG",@"226",@"BF",@"257",@"BI",@"855",@"KH",
@"237",@"CM",@"1",@"CA",@"238",@"CV",@"345",@"KY",
@"236",@"CF",@"235",@"TD",@"56",@"CL",@"86",@"CN",
@"61",@"CX",@"57",@"CO",@"269",@"KM",@"242",@"CG",
@"682",@"CK",@"506",@"CR",@"385",@"HR",@"53",@"CU",
@"537",@"CY",@"420",@"CZ",@"45",@"DK",@"253",@"DJ",
@"1",@"DM",@"1",@"DO",@"593",@"EC",@"20",@"EG",
@"503",@"SV",@"240",@"GQ",@"291",@"ER",@"372",@"EE",
@"251",@"ET",@"298",@"FO",@"679",@"FJ",@"358",@"FI",
@"33",@"FR",@"594",@"GF",@"689",@"PF",@"241",@"GA",
@"220",@"GM",@"995",@"GE",@"49",@"DE",@"233",@"GH",
@"350",@"GI",@"30",@"GR",@"299",@"GL",@"1",@"GD",
@"590",@"GP",@"1",@"GU",@"502",@"GT",@"224",@"GN",
@"245",@"GW",@"595",@"GY",@"509",@"HT",@"504",@"HN",
@"36",@"HU",@"354",@"IS",@"91",@"IN",@"62",@"ID",
@"964",@"IQ",@"353",@"IE",@"972",@"IL",@"39",@"IT",
@"1",@"JM",@"81",@"JP",@"962",@"JO",@"77",@"KZ",
@"254",@"KE",@"686",@"KI",@"965",@"KW",@"996",@"KG",
@"371",@"LV",@"961",@"LB",@"266",@"LS",@"231",@"LR",
@"423",@"LI",@"370",@"LT",@"352",@"LU",@"261",@"MG",
@"265",@"MW",@"60",@"MY",@"960",@"MV",@"223",@"ML",
@"356",@"MT",@"692",@"MH",@"596",@"MQ",@"222",@"MR",
@"230",@"MU",@"262",@"YT",@"52",@"MX",@"377",@"MC",
@"976",@"MN",@"382",@"ME",@"1",@"MS",@"212",@"MA",
@"95",@"MM",@"264",@"NA",@"674",@"NR",@"977",@"NP",
@"31",@"NL",@"599",@"AN",@"687",@"NC",@"64",@"NZ",
@"505",@"NI",@"227",@"NE",@"234",@"NG",@"683",@"NU",
@"672",@"NF",@"1",@"MP",@"47",@"NO",@"968",@"OM",
@"92",@"PK",@"680",@"PW",@"507",@"PA",@"675",@"PG",
@"595",@"PY",@"51",@"PE",@"63",@"PH",@"48",@"PL",
@"351",@"PT",@"1",@"PR",@"974",@"QA",@"40",@"RO",
@"250",@"RW",@"685",@"WS",@"378",@"SM",@"966",@"SA",
@"221",@"SN",@"381",@"RS",@"248",@"SC",@"232",@"SL",
@"65",@"SG",@"421",@"SK",@"386",@"SI",@"677",@"SB",
@"27",@"ZA",@"500",@"GS",@"34",@"ES",@"94",@"LK",
@"249",@"SD",@"597",@"SR",@"268",@"SZ",@"46",@"SE",
@"41",@"CH",@"992",@"TJ",@"66",@"TH",@"228",@"TG",
@"690",@"TK",@"676",@"TO",@"1",@"TT",@"216",@"TN",
@"90",@"TR",@"993",@"TM",@"1",@"TC",@"688",@"TV",
@"256",@"UG",@"380",@"UA",@"971",@"AE",@"44",@"GB",
@"1",@"US",@"598",@"UY",@"998",@"UZ",@"678",@"VU",
@"681",@"WF",@"967",@"YE",@"260",@"ZM",@"263",@"ZW",
@"591",@"BO",@"673",@"BN",@"61",@"CC",@"243",@"CD",
@"225",@"CI",@"500",@"FK",@"44",@"GG",@"379",@"VA",
@"852",@"HK",@"98",@"IR",@"44",@"IM",@"44",@"JE",
@"850",@"KP",@"82",@"KR",@"856",@"LA",@"218",@"LY",
@"853",@"MO",@"389",@"MK",@"691",@"FM",@"373",@"MD",
@"258",@"MZ",@"970",@"PS",@"872",@"PN",@"262",@"RE",
@"7",@"RU",@"590",@"BL",@"290",@"SH",@"1",@"KN",
@"1",@"LC",@"590",@"MF",@"508",@"PM",@"1",@"VC",
@"239",@"ST",@"252",@"SO",@"47",@"SJ",@"963",@"SY",
@"886",@"TW",@"255",@"TZ",@"670",@"TL",@"58",@"VE",
@"84",@"VN",@"1",@"VG",@"1",@"VI",@"672",@"AQ",
@"358",@"AX",@"47",@"BV",@"599",@"BQ",@"599",@"CW",
@"689",@"TF",@"1",@"SX",@"211",@"SS",@"212",@"EH",
@"972",@"IL", nil];
感谢 AlBeebe,我用它来交换它,将国家代码转换为 Swift Dictionary 声明中的拨号前缀。
let prefixCodes = ["AF": "93", "AE": "971", "AL": "355", "AN": "599", "AS":"1", "AD": "376", "AO": "244", "AI": "1", "AG":"1", "AR": "54","AM": "374", "AW": "297", "AU":"61", "AT": "43","AZ": "994", "BS": "1", "BH":"973", "BF": "226","BI": "257", "BD": "880", "BB": "1", "BY": "375", "BE":"32","BZ": "501", "BJ": "229", "BM": "1", "BT":"975", "BA": "387", "BW": "267", "BR": "55", "BG": "359", "BO": "591", "BL": "590", "BN": "673", "CC": "61", "CD":"243","CI": "225", "KH":"855", "CM": "237", "CA": "1", "CV": "238", "KY":"345", "CF":"236", "CH": "41", "CL": "56", "CN":"86","CX": "61", "CO": "57", "KM": "269", "CG":"242", "CK": "682", "CR": "506", "CU":"53", "CY":"537","CZ": "420", "DE": "49", "DK": "45", "DJ":"253", "DM": "1", "DO": "1", "DZ": "213", "EC": "593", "EG":"20", "ER": "291", "EE":"372","ES": "34", "ET": "251", "FM": "691", "FK": "500", "FO": "298", "FJ": "679", "FI":"358", "FR": "33", "GB":"44", "GF": "594", "GA":"241", "GS": "500", "GM":"220", "GE":"995","GH":"233", "GI": "350", "GQ": "240", "GR": "30", "GG": "44", "GL": "299", "GD":"1", "GP": "590", "GU": "1", "GT": "502", "GN":"224","GW": "245", "GY": "595", "HT": "509", "HR": "385", "HN":"504", "HU": "36", "HK": "852", "IR": "98", "IM": "44", "IL": "972", "IO":"246", "IS": "354", "IN": "91", "ID":"62", "IQ":"964", "IE": "353","IT":"39", "JM":"1", "JP": "81", "JO": "962", "JE":"44", "KP": "850", "KR": "82","KZ":"77", "KE": "254", "KI": "686", "KW": "965", "KG":"996","KN":"1", "LC": "1", "LV": "371", "LB": "961", "LK":"94", "LS": "266", "LR":"231", "LI": "423", "LT": "370", "LU": "352", "LA": "856", "LY":"218", "MO": "853", "MK": "389", "MG":"261", "MW": "265", "MY": "60","MV": "960", "ML":"223", "MT": "356", "MH": "692", "MQ": "596", "MR":"222", "MU": "230", "MX": "52","MC": "377", "MN": "976", "ME": "382", "MP": "1", "MS": "1", "MA":"212", "MM": "95", "MF": "590", "MD":"373", "MZ": "258", "NA":"264", "NR":"674", "NP":"977", "NL": "31","NC": "687", "NZ":"64", "NI": "505", "NE": "227", "NG": "234", "NU":"683", "NF": "672", "NO": "47","OM": "968", "PK": "92", "PM": "508", "PW": "680", "PF": "689", "PA": "507", "PG":"675", "PY": "595", "PE": "51", "PH": "63", "PL":"48", "PN": "872","PT": "351", "PR": "1","PS": "970", "QA": "974", "RO":"40", "RE":"262", "RS": "381", "RU": "7", "RW": "250", "SM": "378", "SA":"966", "SN": "221", "SC": "248", "SL":"232","SG": "65", "SK": "421", "SI": "386", "SB":"677", "SH": "290", "SD": "249", "SR": "597","SZ": "268", "SE":"46", "SV": "503", "ST": "239","SO": "252", "SJ": "47", "SY":"963", "TW": "886", "TZ": "255", "TL": "670", "TD": "235", "TJ": "992", "TH": "66", "TG":"228", "TK": "690", "TO": "676", "TT": "1", "TN":"216","TR": "90", "TM": "993", "TC": "1", "TV":"688", "UG": "256", "UA": "380", "US": "1", "UY": "598","UZ": "998", "VA":"379", "VE":"58", "VN": "84", "VG": "1", "VI": "1","VC":"1", "VU":"678", "WS": "685", "WF": "681", "YE": "967", "YT": "262","ZA": "27" , "ZM": "260", "ZW":"263"]
我为此列表生成了 json 文件:
{
"countries": [
{
"code": "+7 840",
"name": "Abkhazia"
},
{
"code": "+93",
"name": "Afghanistan"
},
{
"code": "+355",
"name": "Albania"
},
{
"code": "+213",
"name": "Algeria"
},
{
"code": "+1 684",
"name": "American Samoa"
},
{
"code": "+376",
"name": "Andorra"
},
{
"code": "+244",
"name": "Angola"
},
{
"code": "+1 264",
"name": "Anguilla"
},
{
"code": "+1 268",
"name": "Antigua and Barbuda"
},
{
"code": "+54",
"name": "Argentina"
},
{
"code": "+374",
"name": "Armenia"
},
{
"code": "+297",
"name": "Aruba"
},
{
"code": "+247",
"name": "Ascension"
},
{
"code": "+61",
"name": "Australia"
},
{
"code": "+672",
"name": "Australian External Territories"
},
{
"code": "+43",
"name": "Austria"
},
{
"code": "+994",
"name": "Azerbaijan"
},
{
"code": "+1 242",
"name": "Bahamas"
},
{
"code": "+973",
"name": "Bahrain"
},
{
"code": "+880",
"name": "Bangladesh"
},
{
"code": "+1 246",
"name": "Barbados"
},
{
"code": "+1 268",
"name": "Barbuda"
},
{
"code": "+375",
"name": "Belarus"
},
{
"code": "+32",
"name": "Belgium"
},
{
"code": "+501",
"name": "Belize"
},
{
"code": "+229",
"name": "Benin"
},
{
"code": "+1 441",
"name": "Bermuda"
},
{
"code": "+975",
"name": "Bhutan"
},
{
"code": "+591",
"name": "Bolivia"
},
{
"code": "+387",
"name": "Bosnia and Herzegovina"
},
{
"code": "+267",
"name": "Botswana"
},
{
"code": "+55",
"name": "Brazil"
},
{
"code": "+246",
"name": "British Indian Ocean Territory"
},
{
"code": "+1 284",
"name": "British Virgin Islands"
},
{
"code": "+673",
"name": "Brunei"
},
{
"code": "+359",
"name": "Bulgaria"
},
{
"code": "+226",
"name": "Burkina Faso"
},
{
"code": "+257",
"name": "Burundi"
},
{
"code": "+855",
"name": "Cambodia"
},
{
"code": "+237",
"name": "Cameroon"
},
{
"code": "+1",
"name": "Canada"
},
{
"code": "+238",
"name": "Cape Verde"
},
{
"code": "+ 345",
"name": "Cayman Islands"
},
{
"code": "+236",
"name": "Central African Republic"
},
{
"code": "+235",
"name": "Chad"
},
{
"code": "+56",
"name": "Chile"
},
{
"code": "+86",
"name": "China"
},
{
"code": "+61",
"name": "Christmas Island"
},
{
"code": "+61",
"name": "Cocos-Keeling Islands"
},
{
"code": "+57",
"name": "Colombia"
},
{
"code": "+269",
"name": "Comoros"
},
{
"code": "+242",
"name": "Congo"
},
{
"code": "+243",
"name": "Congo, Dem. Rep. of (Zaire)"
},
{
"code": "+682",
"name": "Cook Islands"
},
{
"code": "+506",
"name": "Costa Rica"
},
{
"code": "+385",
"name": "Croatia"
},
{
"code": "+53",
"name": "Cuba"
},
{
"code": "+599",
"name": "Curacao"
},
{
"code": "+537",
"name": "Cyprus"
},
{
"code": "+420",
"name": "Czech Republic"
},
{
"code": "+45",
"name": "Denmark"
},
{
"code": "+246",
"name": "Diego Garcia"
},
{
"code": "+253",
"name": "Djibouti"
},
{
"code": "+1 767",
"name": "Dominica"
},
{
"code": "+1 809",
"name": "Dominican Republic"
},
{
"code": "+670",
"name": "East Timor"
},
{
"code": "+56",
"name": "Easter Island"
},
{
"code": "+593",
"name": "Ecuador"
},
{
"code": "+20",
"name": "Egypt"
},
{
"code": "+503",
"name": "El Salvador"
},
{
"code": "+240",
"name": "Equatorial Guinea"
},
{
"code": "+291",
"name": "Eritrea"
},
{
"code": "+372",
"name": "Estonia"
},
{
"code": "+251",
"name": "Ethiopia"
},
{
"code": "+500",
"name": "Falkland Islands"
},
{
"code": "+298",
"name": "Faroe Islands"
},
{
"code": "+679",
"name": "Fiji"
},
{
"code": "+358",
"name": "Finland"
},
{
"code": "+33",
"name": "France"
},
{
"code": "+596",
"name": "French Antilles"
},
{
"code": "+594",
"name": "French Guiana"
},
{
"code": "+689",
"name": "French Polynesia"
},
{
"code": "+241",
"name": "Gabon"
},
{
"code": "+220",
"name": "Gambia"
},
{
"code": "+995",
"name": "Georgia"
},
{
"code": "+49",
"name": "Germany"
},
{
"code": "+233",
"name": "Ghana"
},
{
"code": "+350",
"name": "Gibraltar"
},
{
"code": "+30",
"name": "Greece"
},
{
"code": "+299",
"name": "Greenland"
},
{
"code": "+1 473",
"name": "Grenada"
},
{
"code": "+590",
"name": "Guadeloupe"
},
{
"code": "+1 671",
"name": "Guam"
},
{
"code": "+502",
"name": "Guatemala"
},
{
"code": "+224",
"name": "Guinea"
},
{
"code": "+245",
"name": "Guinea-Bissau"
},
{
"code": "+595",
"name": "Guyana"
},
{
"code": "+509",
"name": "Haiti"
},
{
"code": "+504",
"name": "Honduras"
},
{
"code": "+852",
"name": "Hong Kong SAR China"
},
{
"code": "+36",
"name": "Hungary"
},
{
"code": "+354",
"name": "Iceland"
},
{
"code": "+91",
"name": "India"
},
{
"code": "+62",
"name": "Indonesia"
},
{
"code": "+98",
"name": "Iran"
},
{
"code": "+964",
"name": "Iraq"
},
{
"code": "+353",
"name": "Ireland"
},
{
"code": "+972",
"name": "Israel"
},
{
"code": "+39",
"name": "Italy"
},
{
"code": "+225",
"name": "Ivory Coast"
},
{
"code": "+1 876",
"name": "Jamaica"
},
{
"code": "+81",
"name": "Japan"
},
{
"code": "+962",
"name": "Jordan"
},
{
"code": "+7 7",
"name": "Kazakhstan"
},
{
"code": "+254",
"name": "Kenya"
},
{
"code": "+686",
"name": "Kiribati"
},
{
"code": "+965",
"name": "Kuwait"
},
{
"code": "+996",
"name": "Kyrgyzstan"
},
{
"code": "+856",
"name": "Laos"
},
{
"code": "+371",
"name": "Latvia"
},
{
"code": "+961",
"name": "Lebanon"
},
{
"code": "+266",
"name": "Lesotho"
},
{
"code": "+231",
"name": "Liberia"
},
{
"code": "+218",
"name": "Libya"
},
{
"code": "+423",
"name": "Liechtenstein"
},
{
"code": "+370",
"name": "Lithuania"
},
{
"code": "+352",
"name": "Luxembourg"
},
{
"code": "+853",
"name": "Macau SAR China"
},
{
"code": "+389",
"name": "Macedonia"
},
{
"code": "+261",
"name": "Madagascar"
},
{
"code": "+265",
"name": "Malawi"
},
{
"code": "+60",
"name": "Malaysia"
},
{
"code": "+960",
"name": "Maldives"
},
{
"code": "+223",
"name": "Mali"
},
{
"code": "+356",
"name": "Malta"
},
{
"code": "+692",
"name": "Marshall Islands"
},
{
"code": "+596",
"name": "Martinique"
},
{
"code": "+222",
"name": "Mauritania"
},
{
"code": "+230",
"name": "Mauritius"
},
{
"code": "+262",
"name": "Mayotte"
},
{
"code": "+52",
"name": "Mexico"
},
{
"code": "+691",
"name": "Micronesia"
},
{
"code": "+1 808",
"name": "Midway Island"
},
{
"code": "+373",
"name": "Moldova"
},
{
"code": "+377",
"name": "Monaco"
},
{
"code": "+976",
"name": "Mongolia"
},
{
"code": "+382",
"name": "Montenegro"
},
{
"code": "+1664",
"name": "Montserrat"
},
{
"code": "+212",
"name": "Morocco"
},
{
"code": "+95",
"name": "Myanmar"
},
{
"code": "+264",
"name": "Namibia"
},
{
"code": "+674",
"name": "Nauru"
},
{
"code": "+977",
"name": "Nepal"
},
{
"code": "+31",
"name": "Netherlands"
},
{
"code": "+599",
"name": "Netherlands Antilles"
},
{
"code": "+1 869",
"name": "Nevis"
},
{
"code": "+687",
"name": "New Caledonia"
},
{
"code": "+64",
"name": "New Zealand"
},
{
"code": "+505",
"name": "Nicaragua"
},
{
"code": "+227",
"name": "Niger"
},
{
"code": "+234",
"name": "Nigeria"
},
{
"code": "+683",
"name": "Niue"
},
{
"code": "+672",
"name": "Norfolk Island"
},
{
"code": "+850",
"name": "North Korea"
},
{
"code": "+1 670",
"name": "Northern Mariana Islands"
},
{
"code": "+47",
"name": "Norway"
},
{
"code": "+968",
"name": "Oman"
},
{
"code": "+92",
"name": "Pakistan"
},
{
"code": "+680",
"name": "Palau"
},
{
"code": "+970",
"name": "Palestinian Territory"
},
{
"code": "+507",
"name": "Panama"
},
{
"code": "+675",
"name": "Papua New Guinea"
},
{
"code": "+595",
"name": "Paraguay"
},
{
"code": "+51",
"name": "Peru"
},
{
"code": "+63",
"name": "Philippines"
},
{
"code": "+48",
"name": "Poland"
},
{
"code": "+351",
"name": "Portugal"
},
{
"code": "+1 787",
"name": "Puerto Rico"
},
{
"code": "+974",
"name": "Qatar"
},
{
"code": "+262",
"name": "Reunion"
},
{
"code": "+40",
"name": "Romania"
},
{
"code": "+7",
"name": "Russia"
},
{
"code": "+250",
"name": "Rwanda"
},
{
"code": "+685",
"name": "Samoa"
},
{
"code": "+378",
"name": "San Marino"
},
{
"code": "+966",
"name": "Saudi Arabia"
},
{
"code": "+221",
"name": "Senegal"
},
{
"code": "+381",
"name": "Serbia"
},
{
"code": "+248",
"name": "Seychelles"
},
{
"code": "+232",
"name": "Sierra Leone"
},
{
"code": "+65",
"name": "Singapore"
},
{
"code": "+421",
"name": "Slovakia"
},
{
"code": "+386",
"name": "Slovenia"
},
{
"code": "+677",
"name": "Solomon Islands"
},
{
"code": "+27",
"name": "South Africa"
},
{
"code": "+500",
"name": "South Georgia and the South Sandwich Islands"
},
{
"code": "+82",
"name": "South Korea"
},
{
"code": "+34",
"name": "Spain"
},
{
"code": "+94",
"name": "Sri Lanka"
},
{
"code": "+249",
"name": "Sudan"
},
{
"code": "+597",
"name": "Suriname"
},
{
"code": "+268",
"name": "Swaziland"
},
{
"code": "+46",
"name": "Sweden"
},
{
"code": "+41",
"name": "Switzerland"
},
{
"code": "+963",
"name": "Syria"
},
{
"code": "+886",
"name": "Taiwan"
},
{
"code": "+992",
"name": "Tajikistan"
},
{
"code": "+255",
"name": "Tanzania"
},
{
"code": "+66",
"name": "Thailand"
},
{
"code": "+670",
"name": "Timor Leste"
},
{
"code": "+228",
"name": "Togo"
},
{
"code": "+690",
"name": "Tokelau"
},
{
"code": "+676",
"name": "Tonga"
},
{
"code": "+1 868",
"name": "Trinidad and Tobago"
},
{
"code": "+216",
"name": "Tunisia"
},
{
"code": "+90",
"name": "Turkey"
},
{
"code": "+993",
"name": "Turkmenistan"
},
{
"code": "+1 649",
"name": "Turks and Caicos Islands"
},
{
"code": "+688",
"name": "Tuvalu"
},
{
"code": "+1 340",
"name": "U.S. Virgin Islands"
},
{
"code": "+256",
"name": "Uganda"
},
{
"code": "+380",
"name": "Ukraine"
},
{
"code": "+971",
"name": "United Arab Emirates"
},
{
"code": "+44",
"name": "United Kingdom"
},
{
"code": "+1",
"name": "United States"
},
{
"code": "+598",
"name": "Uruguay"
},
{
"code": "+998",
"name": "Uzbekistan"
},
{
"code": "+678",
"name": "Vanuatu"
},
{
"code": "+58",
"name": "Venezuela"
},
{
"code": "+84",
"name": "Vietnam"
},
{
"code": "+1 808",
"name": "Wake Island"
},
{
"code": "+681",
"name": "Wallis and Futuna"
},
{
"code": "+967",
"name": "Yemen"
},
{
"code": "+260",
"name": "Zambia"
},
{
"code": "+255",
"name": "Zanzibar"
},
{
"code": "+263",
"name": "Zimbabwe"
}
]
}
以下是国家/地区拨号代码的快速版本以及国家/地区名称:
func getCountryCallingCode(countryRegionCode:String) -> [String] {
let prefix = ["AF": ["Afghanistan","93"],
"AX": ["Aland Islands","358"],
"AL": ["Albania","355"],
"DZ": ["Algeria","213"],
"AS": ["American Samoa","1"],
"AD": ["Andorra","376"],
"AO": ["Angola","244"],
"AI": ["Anguilla","1"],
"AQ": ["Antarctica","672"],
"AG": ["Antigua and Barbuda","1"],
"AR": ["Argentina","54"],
"AM": ["Armenia","374"],
"AW": ["Aruba","297"],
"AU": ["Australia","61"],
"AT": ["Austria","43"],
"AZ": ["Azerbaijan","994"],
"BS": ["Bahamas","1"],
"BH": ["Bahrain","973"],
"BD": ["Bangladesh","880"],
"BB": ["Barbados","1"],
"BY": ["Belarus","375"],
"BE": ["Belgium","32"],
"BZ": ["Belize","501"],
"BJ": ["Benin","229"],
"BM": ["Bermuda","1"],
"BT": ["Bhutan","975"],
"BO": ["Bolivia","591"],
"BA": ["Bosnia and Herzegovina","387"],
"BW": ["Botswana","267"],
"BV": ["Bouvet Island","47"],
"BQ": ["BQ","599"],
"BR": ["Brazil","55"],
"IO": ["British Indian Ocean Territory","246"],
"VG": ["British Virgin Islands","1"],
"BN": ["Brunei Darussalam","673"],
"BG": ["Bulgaria","359"],
"BF": ["Burkina Faso","226"],
"BI": ["Burundi","257"],
"KH": ["Cambodia","855"],
"CM": ["Cameroon","237"],
"CA": ["Canada","1"],
"CV": ["Cape Verde","238"],
"KY": ["Cayman Islands","345"],
"CF": ["Central African Republic","236"],
"TD": ["Chad","235"],
"CL": ["Chile","56"],
"CN": ["China","86"],
"CX": ["Christmas Island","61"],
"CC": ["Cocos (Keeling) Islands","61"],
"CO": ["Colombia","57"],
"KM": ["Comoros","269"],
"CG": ["Congo (Brazzaville)","242"],
"CD": ["Congo, Democratic Republic of the","243"],
"CK": ["Cook Islands","682"],
"CR": ["Costa Rica","506"],
"CI": ["Côte d'Ivoire","225"],
"HR": ["Croatia","385"],
"CU": ["Cuba","53"],
"CW": ["Curacao","599"],
"CY": ["Cyprus","537"],
"CZ": ["Czech Republic","420"],
"DK": ["Denmark","45"],
"DJ": ["Djibouti","253"],
"DM": ["Dominica","1"],
"DO": ["Dominican Republic","1"],
"EC": ["Ecuador","593"],
"EG": ["Egypt","20"],
"SV": ["El Salvador","503"],
"GQ": ["Equatorial Guinea","240"],
"ER": ["Eritrea","291"],
"EE": ["Estonia","372"],
"ET": ["Ethiopia","251"],
"FK": ["Falkland Islands (Malvinas)","500"],
"FO": ["Faroe Islands","298"],
"FJ": ["Fiji","679"],
"FI": ["Finland","358"],
"FR": ["France","33"],
"GF": ["French Guiana","594"],
"PF": ["French Polynesia","689"],
"TF": ["French Southern Territories","689"],
"GA": ["Gabon","241"],
"GM": ["Gambia","220"],
"GE": ["Georgia","995"],
"DE": ["Germany","49"],
"GH": ["Ghana","233"],
"GI": ["Gibraltar","350"],
"GR": ["Greece","30"],
"GL": ["Greenland","299"],
"GD": ["Grenada","1"],
"GP": ["Guadeloupe","590"],
"GU": ["Guam","1"],
"GT": ["Guatemala","502"],
"GG": ["Guernsey","44"],
"GN": ["Guinea","224"],
"GW": ["Guinea-Bissau","245"],
"GY": ["Guyana","595"],
"HT": ["Haiti","509"],
"VA": ["Holy See (Vatican City State)","379"],
"HN": ["Honduras","504"],
"HK": ["Hong Kong, Special Administrative Region of China","852"],
"HU": ["Hungary","36"],
"IS": ["Iceland","354"],
"IN": ["India","91"],
"ID": ["Indonesia","62"],
"IR": ["Iran, Islamic Republic of","98"],
"IQ": ["Iraq","964"],
"IE": ["Ireland","353"],
"IM": ["Isle of Man","44"],
"IL": ["Israel","972"],
"IT": ["Italy","39"],
"JM": ["Jamaica","1"],
"JP": ["Japan","81"],
"JE": ["Jersey","44"],
"JO": ["Jordan","962"],
"KZ": ["Kazakhstan","77"],
"KE": ["Kenya","254"],
"KI": ["Kiribati","686"],
"KP": ["Korea, Democratic People's Republic of","850"],
"KR": ["Korea, Republic of","82"],
"KW": ["Kuwait","965"],
"KG": ["Kyrgyzstan","996"],
"LA": ["Lao PDR","856"],
"LV": ["Latvia","371"],
"LB": ["Lebanon","961"],
"LS": ["Lesotho","266"],
"LR": ["Liberia","231"],
"LY": ["Libya","218"],
"LI": ["Liechtenstein","423"],
"LT": ["Lithuania","370"],
"LU": ["Luxembourg","352"],
"MO": ["Macao, Special Administrative Region of China","853"],
"MK": ["Macedonia, Republic of","389"],
"MG": ["Madagascar","261"],
"MW": ["Malawi","265"],
"MY": ["Malaysia","60"],
"MV": ["Maldives","960"],
"ML": ["Mali","223"],
"MT": ["Malta","356"],
"MH": ["Marshall Islands","692"],
"MQ": ["Martinique","596"],
"MR": ["Mauritania","222"],
"MU": ["Mauritius","230"],
"YT": ["Mayotte","262"],
"MX": ["Mexico","52"],
"FM": ["Micronesia, Federated States of","691"],
"MD": ["Moldova","373"],
"MC": ["Monaco","377"],
"MN": ["Mongolia","976"],
"ME": ["Montenegro","382"],
"MS": ["Montserrat","1"],
"MA": ["Morocco","212"],
"MZ": ["Mozambique","258"],
"MM": ["Myanmar","95"],
"NA": ["Namibia","264"],
"NR": ["Nauru","674"],
"NP": ["Nepal","977"],
"NL": ["Netherlands","31"],
"AN": ["Netherlands Antilles","599"],
"NC": ["New Caledonia","687"],
"NZ": ["New Zealand","64"],
"NI": ["Nicaragua","505"],
"NE": ["Niger","227"],
"NG": ["Nigeria","234"],
"NU": ["Niue","683"],
"NF": ["Norfolk Island","672"],
"MP": ["Northern Mariana Islands","1"],
"NO": ["Norway","47"],
"OM": ["Oman","968"],
"PK": ["Pakistan","92"],
"PW": ["Palau","680"],
"PS": ["Palestinian Territory, Occupied","970"],
"PA": ["Panama","507"],
"PG": ["Papua New Guinea","675"],
"PY": ["Paraguay","595"],
"PE": ["Peru","51"],
"PH": ["Philippines","63"],
"PN": ["Pitcairn","872"],
"PL": ["Poland","48"],
"PT": ["Portugal","351"],
"PR": ["Puerto Rico","1"],
"QA": ["Qatar","974"],
"RE": ["Réunion","262"],
"RO": ["Romania","40"],
"RU": ["Russian Federation","7"],
"RW": ["Rwanda","250"],
"SH": ["Saint Helena","290"],
"KN": ["Saint Kitts and Nevis","1"],
"LC": ["Saint Lucia","1"],
"PM": ["Saint Pierre and Miquelon","508"],
"VC": ["Saint Vincent and Grenadines","1"],
"BL": ["Saint-Barthélemy","590"],
"MF": ["Saint-Martin (French part)","590"],
"WS": ["Samoa","685"],
"SM": ["San Marino","378"],
"ST": ["Sao Tome and Principe","239"],
"SA": ["Saudi Arabia","966"],
"SN": ["Senegal","221"],
"RS": ["Serbia","381"],
"SC": ["Seychelles","248"],
"SL": ["Sierra Leone","232"],
"SG": ["Singapore","65"],
"SX": ["Sint Maarten","1"],
"SK": ["Slovakia","421"],
"SI": ["Slovenia","386"],
"SB": ["Solomon Islands","677"],
"SO": ["Somalia","252"],
"ZA": ["South Africa","27"],
"GS": ["South Georgia and the South Sandwich Islands","500"],
"SS": ["South Sudan","211"],
"ES": ["Spain","34"],
"LK": ["Sri Lanka","94"],
"SD": ["Sudan","249"],
"SR": ["Suriname","597"],
"SJ": ["Svalbard and Jan Mayen Islands","47"],
"SZ": ["Swaziland","268"],
"SE": ["Sweden","46"],
"CH": ["Switzerland","41"],
"SY": ["Syrian Arab Republic (Syria)","963"],
"TW": ["Taiwan, Republic of China","886"],
"TJ": ["Tajikistan","992"],
"TZ": ["Tanzania, United Republic of","255"],
"TH": ["Thailand","66"],
"TL": ["Timor-Leste","670"],
"TG": ["Togo","228"],
"TK": ["Tokelau","690"],
"TO": ["Tonga","676"],
"TT": ["Trinidad and Tobago","1"],
"TN": ["Tunisia","216"],
"TR": ["Turkey","90"],
"TM": ["Turkmenistan","993"],
"TC": ["Turks and Caicos Islands","1"],
"TV": ["Tuvalu","688"],
"UG": ["Uganda","256"],
"UA": ["Ukraine","380"],
"AE": ["United Arab Emirates","971"],
"GB": ["United Kingdom","44"],
"US": ["United States of America","1"],
"UY": ["Uruguay","598"],
"UZ": ["Uzbekistan","998"],
"VU": ["Vanuatu","678"],
"VE": ["Venezuela (Bolivarian Republic of)","58"],
"VN": ["Viet Nam","84"],
"VI": ["Virgin Islands, US","1"],
"WF": ["Wallis and Futuna Islands","681"],
"EH": ["Western Sahara","212"],
"YE": ["Yemen","967"],
"ZM": ["Zambia","260"],
"ZW": ["Zimbabwe","263"]]
let countryDialingCode = prefix[countryRegionCode]
return countryDialingCode!
}
然后调用上述函数以使用拨号代码和相应的国家名称显示在 UI 中。
let currentLocale = NSLocale.currentLocale()
let countryCode = currentLocale.objectForKey(NSLocaleCountryCode) as! String
print("Country code according to Locale \(countryCode)")
let countryArray = getCountryCallingCode(countryCode)
print("Country Array according to the Locale \(countryArray)")
print("Country Name \(countryArray[0])")
print("Dialing code \(countryArray[1])")
多合一解决方案:带有代码和标志的国家名称。通过此代码,您还可以按名称创建部分。如果这真的对你有帮助,请支持
self.aryCountryName= [[NSMutableArray alloc]initWithObjects:@"Afghanistan",@"Albania",@"Algeria",@"Andorra",@"Angola",@"Antigua and Barbuda",@"Argentina",@"Armenia",@"Australia",@"Austria",@"Azerbaijan",@"Bahamas",@"Bahrain",@"Bangladesh",@"Barbados",@"Belarus",@"Belgium",@"Belize",@"Benin",@"Bhutan",@"Bolivia",@"Bosnia and Herzegovina",@"Botswana",@"Brazil",@"Brunei Darussalam",@"Bulgaria",@"Burkina Faso",@"Burundi",@"Cabo Verde",@"Cambodia",@"Cameroon",@"Canada",@"Central African Republic",@"Chad",@"Chile",@"China",@"Colombia",@"Comoros",@"Congo",@"Costa Rica",@"Côte d'Ivoire",@"Croatia",@"Cuba",@"Cyprus",@"Czech Republic",@"Democratic People's Republic of Korea (North Korea)",@"Democratic Republic of the Cong",@"Denmark",@"Djibouti",@"Dominica",@"Dominican Republic",@"Ecuador",@"Egypt",@"El Salvador",@"Equatorial Guinea",@"Eritrea",@"Estonia",@"Ethiopia",@"Fiji",@"Finland",@"France",@"Gabon",@"Gambia",@"Georgia",@"Germany",@"Ghana",@"Greece",@"Grenada",@"Guatemala",@"Guinea",@"Guinea-Bissau",@"Guyana",@"Haiti",@"Honduras",@"Hungary",@"Iceland",@"India",@"Indonesia",@"Iran",@"Iraq",@"Ireland",@"Israel",@"Italy",@"Jamaica",@"Japan",@"Jordan",@"Kazakhstan",@"Kenya",@"Kiribati",@"Kuwait",@"Kyrgyzstan",@"Lao People's Democratic Republic (Laos)",@"Latvia",@"Lebanona",@"Lesotho",@"Liberia",@"Libya",@"Liechtenstein",@"Lithuania",@"Luxembourg",@"Macedonia",@"Madagascar",@"Malawi",@"Malaysia",@"Maldives",@"Mali",@"Malta",@"Marshall Islands",@"Mauritania",@"Mauritius",@"Mexico",@"Micronesia (Federated States of)",@"Monaco",@"Mongolia",@"Montenegro",@"Morocco",@"Mozambique",@"Myanmar",@"Namibia",@"Nauru",@"Nepal",@"Netherlands",@"New Zealand",@"Nicaragua",@"Niger",@"Nigeria",@"Norway",@"Oman",@"pakistan",@"palau",@"panama",@"papua New Guinew",@"Paraguay",@"Peru",@"philippines",@"Poland",@"Portugal",@"Qatar",@"Republic of Korea (South Korea)",@"Republic of Moldova",@"Romania",@"Russian Federation",@"Rwanda",@"Saint Kitts and Nevis",@"Saint Lucia",@"Saint Vincent and the Grenadines",@"Samoa",@"San Marino",@"Sao Tome and Principe",@"Saudi Arabia",@"Senegal",@"Serbia",@"Seychelles",@"Sierra Leone",@"Singapore",@"Slovakia",@"Slovenia",@"Solomon Islands",@"Somalia",@"South Africa",@"South Sudan",@"Spain",@"Sri lanka",@"Sudan",@"Suriname",@"Swaziland",@"Sweden",@"Swazerland",@"Syrian Arab Republic",@"Tajikistan",@"Thailand",@"Timor-Leste",@"Togo",@"Tonga",@"Trinidad and Tobago",@"Tunisia",@"Turkey" ,@" Turkmenistan",@"Tuvalu",@"Uganda",@"Ukraine",@"United Arab Emirates",@"United Kingdom of Great Britain and Northern Ireland",@"United Republic of Tanzania",@"United States of America",@"Uruguay",@"Uzbekistan",@"Vanuatu",@"Venezuela",@"Vietnam",@"Yemen",@"Zambia",@"Zimbabwe",nil] ;
// Country Code Array
self.aryCountryCode= [[NSMutableArray alloc]initWithObjects:@"93",@"355",@"213",@"376",@"244",@"1268",@"54",@"374",@"61",@"43",@"994",@"1242",@"973",@"880",@"1246",@"375",@"32",@"501",@"229",@"975",@"591",@"387",@"267",@"55",@"673",@"359",@"226",@"257",@"238",@"855",@"237",@"1",@"236",@"235",@"56",@"86",@"57",@"269",@"242",@"506",@"225",@"385",@"53",@"357",@"420",@"850",@"243",@"45",@"253",@"1767",@"1809",@"593",@"20",@"503",@"240",@"291",@"372",@"251",@"679",@"358",@"33",@"241",@"220",@"995",@"49",@"233",@"30",@"1473",@"502",@"224",@"245",@"592",@"509",@"504",@"36",@"354",@"91",@"62",@"98",@"964",@"353",@"972",@"39",@"1876",@"81",@"962",@"76",@"254",@"686",@"965",@"996",@"856",@"371",@"961",@"266",@"231",@"218",@"423",@"370",@"352",@"389",@"261",@"265",@"60",@"960",@"223",@"356",@"692",@"222",@"230",@"52",@"691",@"377",@"976",@"382",@"212",@"258",@"95",@"264",@"674",@"977",@"31",@"64",@"505",@"227",@"234",@"47",@"968",@"92",@"680",@"507",@"675",@"595",@"51",@"63",@"48",@"351",@"974",@"82",@"373",@"40",@"7",@"250",@"1869",@"1758",@"1784",@"685",@"378",@"239",@"966",@"221",@"381",@"248",@"232",@"65",@"421",@"386",@"677",@"252",@"27",@"211",@"34",@"94",@"249",@"597",@"268",@"46",@"41",@"963",@"992",@"66",@"670",@"228",@"676",@"1868",@"216",@"90",@"993",@"688",@"256",@"380",@"971",@"44",@"255",@"1",@"598",@"998",@"678",@"58",@"84",@"967",@"260",@"263",nil];
// Country Flag Array
self.aryCountryFlag =[[ NSMutableArray alloc]initWithObjects:@"af_32.png",@"al_32.png",@"dz_32.png",@"ad_32.png",@"ao_32.png",@"ag_32.png",@"ar_32.png",@"am_32.png",@"au_32.png",@"at_32.png",@"az_32.png",@"bs_32.png",@"bh_32.png",@"bd_32.png",@"bb_32.png",@"by_32.png",@"be_32.png",@"bz_32.png",@"bj_32.png",@"bt_32.png",@"bo_32.png",@"ba_32.png",@"bw_32.png",@"br_32.png",@"bn_32.png",@"bg_32.png",@"bf_32.png",@"bi_32.png",@"cv_32.png",@"kh_32.png",@"cm_32.png",@"ca_32.png",@"cf_32.png",@"td_32.png",@"cl_32.png",@"cn_32.png",@"co_32.png",@"km_32.png",@"cg_32.png",@"cr_32.png",@"ci_32.png",@"hr_32.png",@"cu_32.png",@"cy_32.png",@"cz_32.png",@"kp_32.png",@"cd_32.png",@"dk_32.png",@"dj_32.png",@"dm_32.png",@"do_32.png",@"ec_32.png",@"eg_32.png",@"sv_32.png",@"gq_32.png",@"er_32.png",@"ee_32.png",@"et_32.png",@"fj_32.png",@"fi_32.png",@"fr_32.png",@"ga_32.png",@"gm_32.png",@"ge_32.png",@"de_32.png",@"gh_32.png",@"gr_32.png",@"gd_32.png",@"gt_32.png",@"gn_32.png",@"gw_32.png",@"gy_32.png",@"ht_32.png",@"hn_32.png",@"hu_32.png",@"is_32.png",@"in_32.png",@"id_32.png",@"ir_32.png",@"iq_32.png",@"ie_32.png",@"il_32.png",@"it_32.png",@"jm_32.png",@"jp_32.png",@"jo_32.png",@"kz_32.png",@"ke_32.png",@"ki_32.png",@"kw_32.png",@"kg_32.png",@"la_32.png",@"lv_32.png",@"lb_32.png",@"ls_32.png",@"lr_32.png",@"ly_32.png",@"li_32.png",@"lt_32.png",@"lu_32.png",@"mk_32.png",@"mg_32.png",@"mw_32.png",@"my_32.png",@"mv_32.png",@"ml_32.png",@"mt_32.png",@"mh_32.png", @"mr_32.png",@"mu_32.png",@"mx_32.png",@"fm_32.png",@"mc_32.png",@"mn_32.png",@"me_32.png",@"ma_32.png",@"mz_32.png",@"mm_32.png",@"na_32.png",@"nr_32.png",@"np_32.png",@"nl_32.png",@"nz_32.png",@"ni_32.png",@"ne_32.png",@"ng_32.png",@"no_32.png",@"om_32.png",@"pk_32.png",@"pw_32.png",@"pa_32.png",@"pg_32.png",@"py_32.png",@"pe_32.png",@"ph_32.png",@"pl_32.png",@"pt_32.png",@"qa_32.png",@"kr_32.png",@"md_32.png",@"ro_32.png",@"ru_32.png",@"rw_32.png",@"kn_32.png",@"lc_32.png",@"vc_32.png",@"ws_32.png",@"sm_32.png",@"st_32.png",@"sa_32.png",@"sn_32.png",@"rs_32.png",@"sc_32.png",@"sl_32.png",@"sg_32.png",@"sk_32.png",@"si_32.png",@"sb_32.png",@"so_32.png",@"za_32.png",@"ss_32.png",@"es_32.png",@"lk_32.png",@"sd_32.png",@"sr_32.png",@"sz_32.png",@"se_32.png",@"ch_32.png",@"sy_32.png",@"tj_32.png",@"th_32.png",@"tl_32.png",@"tg_32.png",@"to_32.png",@"tt_32.png",@"tn_32.png",@"tr_32.png",@"tm_32.png",@"tv_32.png",@"ug_32.png",@"ua_32.png",@"ae_32.png",@"gb_32.png",@"tz_32.png",@"us_32.png",@"uy_32.png",@"uz_32.png",@"vu_32.png",@"ve_32.png",@"vn_32.png",@"ye_32.png",@"zm_32.png",@"zw_32.png",nil];
// Counrty Name Dic
self.dicCountryName= @{@"A" : @[@"Afghanistan",@"Albania",@"Algeria",@"Andorra",@"Angola",@"Antigua and Barbuda",@"Argentina",@"Armenia",@"Australia",@"Austria",@"Azerbaijan"],
@"B" : @[@"Bahamas",@"Bahrain",@"Bangladesh",@"Barbados",@"Belarus",@"Belgium",@"Belize",@"Benin",@"Bhutan",@"Bolivia",@"Bosnia and Herzegovina",@"Botswana",@"Brazil",@"Brunei Darussalam",@"Bulgaria",@"Burkina Faso",@"Burundi"],
@"C" : @[@"Cabo Verde",@"Cambodia",@"Cameroon",@"Canada",@"Central African Republic",@"Chad",@"Chile",@"China",@"Colombia",@"Comoros",@"Congo",@"Costa Rica",@"Côte d'Ivoire",@"Croatia",@"Cuba",@"Cyprus",@"Czech Republic"],
@"D" : @[@"Democratic People's Republic of Korea (North Korea)",@"Democratic Republic of the Cong",@"Denmark",@"Djibouti",@"Dominica",@"Dominican Republic"],
@"E" : @[@"Ecuador",@"Egypt",@"El Salvador",@"Equatorial Guinea",@"Eritrea",@"Estonia",@"Ethiopia"],
@"F" : @[@"Fiji",@"Finland",@"France"],
@"G" : @[@"Gabon",@"Gambia",@"Georgia",@"Germany",@"Ghana",@"Greece",@"Grenada",@"Guatemala",@"Guinea",@"Guinea-Bissau",@"Guyana"],
@"H" : @[@"Haiti",@"Honduras",@"Hungary"],
@"I" : @[@"Iceland",@"India",@"Indonesia",@"Iran",@"Iraq",@"Ireland",@"Israel",@"Italy"],
@"J" : @[@"Jamaica",@"Japan",@"Jordan"],
@"K" : @[@"Kazakhstan",@"Kenya",@"Kiribati",@"Kuwait",@"Kyrgyzstan"],
@"L" : @[@"Lao People's Democratic Republic (Laos)",@"Latvia",@"Lebanona",@"Lesotho",@"Liberia",@"Libya",@"Liechtenstein",@"Lithuania",@"Luxembourg"],
@"M" : @[@"Macedonia",@"Madagascar",@"Malawi",@"Malaysia",@"Maldives",@"Mali",@"Malta",@"Marshall Islands",@"Mauritania",@"Mauritius",@"Mexico",@"Micronesia (Federated States of)",@"Monaco",@"Mongolia",@"Montenegro",@"Morocco",@"Mozambique",@"Myanmar"],
@"N" : @[@"Namibia",@"Nauru",@"Nepal",@"Netherlands",@"New Zealand",@"Nicaragua",@"Niger",@"Nigeria",@"Norway"],
@"O" : @[@"Oman"],
@"P" : @[@"pakistan",@"palau",@"panama",@"papua New Guinew",@"Paraguay",@"Peru",@"philippines",@"Poland",@"Portugal"],
@"Q" : @[@"Qatar"],
@"R" : @[@"Republic of Korea (South Korea)",@"Republic of Moldova",@"Romania",@"Russian Federation",@"Rwanda"],
@"S" : @[@"Saint Kitts and Nevis",@"Saint Lucia",@"Saint Vincent and the Grenadines",@"Samoa",@"San Marino",@"Sao Tome and Principe",@"Saudi Arabia",@"Senegal",@"Serbia",@"Seychelles",@"Sierra Leone",@"Singapore",@"Slovakia",@"Slovenia",@"Solomon Islands",@"Somalia",@"South Africa",@"South Sudan",@"Spain",@"Sri lanka",@"Sudan",@"Suriname",@"Swaziland",@"Sweden",@"Swazerland",@"Syrian Arab Republic"],
@"T" : @[@"Tajikistan",@"Thailand",@"Timor-Leste",@"Togo",@"Tonga",@"Trinidad and Tobago",@"Tunisia",@"Turkey" ,@" Turkmenistan",@"Tuvalu"],
@"U" : @[@"Uganda",@"Ukraine",@"United Arab Emirates",@"United Kingdom of Great Britain and Northern Ireland",@"United Republic of Tanzania",@"United States of America",@"Uruguay",@"Uzbekistan"],
@"V" : @[@"Vanuatu",@"Venezuela",@"Vietnam"],
@"Y" : @[@"Yemen"],
@"Z" : @[@"Zambia",@"Zimbabwe"]};
// Country Code Dic
self.dicCountryCode = @{@"A" : @[@"93",@"355",@"213",@"376",@"244",@"1268",@"54",@"374",@"61",@"43",@"994"],
@"B" : @[@"1242",@"973",@"880",@"1246",@"375",@"32",@"501",@"229",@"975",@"591",@"387",@"267",@"55",@"673",@"359",@"226",@"257"],
@"C" : @[@"238",@"855",@"237",@"1",@"236",@"235",@"56",@"86",@"57",@"269",@"242",@"506",@"225",@"385",@"53",@"357",@"420"],
@"D" : @[@"850",@"243",@"45",@"253",@"1767",@"1809"],
@"E" : @[@"593",@"20",@"503",@"240",@"291",@"372",@"251"],
@"F" : @[@"679",@"358",@"33"],
@"G" : @[@"241",@"220",@"995",@"49",@"233",@"30",@"1473",@"502",@"224",@"245",@"592"],
@"H" : @[@"509",@"504",@"36"],
@"I" : @[@"354",@"91",@"62",@"98",@"964",@"353",@"972",@"39"],
@"J" : @[@"1876",@"81",@"962"],
@"K" : @[@"76",@"254",@"686",@"965",@"996"],
@"L" : @[@"856",@"371",@"961",@"266",@"231",@"218",@"423",@"370",@"352"],
@"M" :@[@"389",@"261",@"265",@"60",@"960",@"223",@"356",@"692",@"222",@"230",@"52",@"691",@"377",@"976",@"382",@"212",@"258",@"95"],
@"N" : @[@"264",@"674",@"977",@"31",@"64",@"505",@"227",@"234",@"47"],
@"O" : @[@"968"],
@"P" : @[@"92",@"680",@"507",@"675",@"595",@"51",@"63",@"48",@"351"],
@"Q" : @[@"974"],
@"R" : @[@"82",@"373",@"40",@"7",@"250"],
@"S" : @[@"1869",@"1758",@"1784",@"685",@"378",@"239",@"966",@"221",@"381",@"248",@"232",@"65",@"421",@"386",@"677",@"252",@"27",@"211",@"34",@"94",@"249",@"597",@"268",@"46",@"41",@"963"],
@"T" : @[@"992",@"66",@"670",@"228",@"676",@"1868",@"216",@"90",@"993",@"688"],
@"U" : @[@"256",@"380",@"971",@"44",@"255",@"1",@"598",@"998"],
@"V" : @[@"678",@"58",@"84"],
@"Y" : @[@"967"],
@"Z" : @[@"260",@"263"]};
// Country Flag Dic is below
self.dicCountryFlag = @{@"A" : @[@"af_32.png",@"al_32.png",@"dz_32.png",@"ad_32.png",@"ao_32.png",@"ag_32.png",@"ar_32.png",@"am_32.png",@"au_32.png",@"at_32.png",@"az_32.png"],
@"B" : @[@"bs_32.png",@"bh_32.png",@"bd_32.png",@"bb_32.png",@"by_32.png",@"be_32.png",@"bz_32.png",@"bj_32.png",@"bt_32.png",@"bo_32.png",@"ba_32.png",@"bw_32.png",@"br_32.png",@"bn_32.png",@"bg_32.png",@"bf_32.png",@"bi_32.png"],
@"C" : @[@"cv_32.png",@"kh_32.png",@"cm_32.png",@"ca_32.png",@"cf_32.png",@"td_32.png",@"cl_32.png",@"cn_32.png",@"co_32.png",@"km_32.png",@"cg_32.png",@"cr_32.png",@"ci_32.png",@"hr_32.png",@"cu_32.png",@"cy_32.png",@"cz_32.png"],
@"D" : @[@"kp_32.png",@"cd_32.png",@"dk_32.png",@"dj_32.png",@"dm_32.png",@"do_32.png"],
@"E" : @[@"ec_32.png",@"eg_32.png",@"sv_32.png",@"gq_32.png",@"er_32.png",@"ee_32.png",@"et_32.png"],
@"F" : @[@"fj_32.png",@"fi_32.png",@"fr_32.png"],
@"G" : @[@"ga_32.png",@"gm_32.png",@"ge_32.png",@"de_32.png",@"gh_32.png",@"gr_32.png",@"gd_32.png",@"gt_32.png",@"gn_32.png",@"gw_32.png",@"gy_32.png"],
@"H" : @[@"ht_32.png",@"hn_32.png",@"hu_32.png"],
@"I" : @[@"is_32.png",@"in_32.png",@"id_32.png",@"ir_32.png",@"iq_32.png",@"ie_32.png",@"il_32.png",@"it_32.png"],
@"J" : @[@"jm_32.png",@"jp_32.png",@"jo_32.png"],
@"K" : @[@"kz_32.png",@"ke_32.png",@"ki_32.png",@"kw_32.png",@"kg_32.png"],
@"L" : @[@"la_32.png",@"lv_32.png",@"lb_32.png",@"ls_32.png",@"lr_32.png",@"ly_32.png",@"li_32.png",@"lt_32.png",@"lu_32.png"],
@"M" :@[@"mk_32.png",@"mg_32.png",@"mw_32.png",@"my_32.png",@"mv_32.png",@"ml_32.png",@"mt_32.png",@"mh_32.png", @"mr_32.png",@"mu_32.png",@"mx_32.png",@"fm_32.png",@"mc_32.png",@"mn_32.png",@"me_32.png",@"ma_32.png",@"mz_32.png",@"mm_32.png"],
@"N" : @[@"na_32.png",@"nr_32.png",@"np_32.png",@"nl_32.png",@"nz_32.png",@"ni_32.png",@"ne_32.png",@"ng_32.png",@"no_32.png"],
@"O" : @[@"om_32.png"],
@"P" : @[@"pk_32.png",@"pw_32.png",@"pa_32.png",@"pg_32.png",@"py_32.png",@"pe_32.png",@"ph_32.png",@"pl_32.png",@"pt_32.png"],
@"Q" : @[@"qa_32.png"],
@"R" : @[@"kr_32.png",@"md_32.png",@"ro_32.png",@"ru_32.png",@"rw_32.png"],
@"S" : @[@"kn_32.png",@"lc_32.png",@"vc_32.png",@"ws_32.png",@"sm_32.png",@"st_32.png",@"sa_32.png",@"sn_32.png",@"rs_32.png",@"sc_32.png",@"sl_32.png",@"sg_32.png",@"sk_32.png",@"si_32.png",@"sb_32.png",@"so_32.png",@"za_32.png",@"ss_32.png",@"es_32.png",@"lk_32.png",@"sd_32.png",@"sr_32.png",@"sz_32.png",@"se_32.png",@"ch_32.png",@"sy_32.png"],
@"T" : @[@"tj_32.png",@"th_32.png",@"tl_32.png",@"tg_32.png",@"to_32.png",@"tt_32.png",@"tn_32.png",@"tr_32.png",@"tm_32.png",@"tv_32.png"],
@"U" : @[@"ug_32.png",@"ua_32.png",@"ae_32.png",@"gb_32.png",@"tz_32.png",@"us_32.png",@"uy_32.png",@"uz_32.png"],
@"V" : @[@"vu_32.png",@"ve_32.png",@"vn_32.png"],
@"Y" : @[@"ye_32.png"],
@"Z" : @[@"zm_32.png",@"zw_32.png"]};
self.countryIndexTitles = @[@"A", @"B", @"C", @"D", @"E", @"F", @"G", @"H", @"I", @"J", @"K", @"L", @"M", @"N", @"O", @"P", @"Q", @"R", @"S", @"T", @"U", @"V", @"W", @"X", @"Y", @"Z"];
}
带有完整的国家名称:
[NSDictionary dictionaryWithObjectsAndKeys:
@[@"Afghanistan",@"93"],@"AF",
@[@"Aland Islands",@"358"],@"AX",
@[@"Albania",@"355"],@"AL",
@[@"Algeria",@"213"],@"DZ",
@[@"American Samoa",@"1"],@"AS",
@[@"Andorra",@"376"],@"AD",
@[@"Angola",@"244"],@"AO",
@[@"Anguilla",@"1"],@"AI",
@[@"Antarctica",@"672"],@"AQ",
@[@"Antigua and Barbuda",@"1"],@"AG",
@[@"Argentina",@"54"],@"AR",
@[@"Armenia",@"374"],@"AM",
@[@"Aruba",@"297"],@"AW",
@[@"Australia",@"61"],@"AU",
@[@"Austria",@"43"],@"AT",
@[@"Azerbaijan",@"994"],@"AZ",
@[@"Bahamas",@"1"],@"BS",
@[@"Bahrain",@"973"],@"BH",
@[@"Bangladesh",@"880"],@"BD",
@[@"Barbados",@"1"],@"BB",
@[@"Belarus",@"375"],@"BY",
@[@"Belgium",@"32"],@"BE",
@[@"Belize",@"501"],@"BZ",
@[@"Benin",@"229"],@"BJ",
@[@"Bermuda",@"1"],@"BM",
@[@"Bhutan",@"975"],@"BT",
@[@"Bolivia",@"591"],@"BO",
@[@"Bosnia and Herzegovina",@"387"],@"BA",
@[@"Botswana",@"267"],@"BW",
@[@"Bouvet Island",@"47"],@"BV",
@[@"BQ",@"599"],@"BQ",
@[@"Brazil",@"55"],@"BR",
@[@"British Indian Ocean Territory",@"246"],@"IO",
@[@"British Virgin Islands",@"1"],@"VG",
@[@"Brunei Darussalam",@"673"],@"BN",
@[@"Bulgaria",@"359"],@"BG",
@[@"Burkina Faso",@"226"],@"BF",
@[@"Burundi",@"257"],@"BI",
@[@"Cambodia",@"855"],@"KH",
@[@"Cameroon",@"237"],@"CM",
@[@"Canada",@"1"],@"CA",
@[@"Cape Verde",@"238"],@"CV",
@[@"Cayman Islands",@"345"],@"KY",
@[@"Central African Republic",@"236"],@"CF",
@[@"Chad",@"235"],@"TD",
@[@"Chile",@"56"],@"CL",
@[@"China",@"86"],@"CN",
@[@"Christmas Island",@"61"],@"CX",
@[@"Cocos (Keeling) Islands",@"61"],@"CC",
@[@"Colombia",@"57"],@"CO",
@[@"Comoros",@"269"],@"KM",
@[@"Congo (Brazzaville)",@"242"],@"CG",
@[@"Congo, Democratic Republic of the",@"243"],@"CD",
@[@"Cook Islands",@"682"],@"CK",
@[@"Costa Rica",@"506"],@"CR",
@[@"Côte d'Ivoire",@"225"],@"CI",
@[@"Croatia",@"385"],@"HR",
@[@"Cuba",@"53"],@"CU",
@[@"Curacao",@"599"],@"CW",
@[@"Cyprus",@"537"],@"CY",
@[@"Czech Republic",@"420"],@"CZ",
@[@"Denmark",@"45"],@"DK",
@[@"Djibouti",@"253"],@"DJ",
@[@"Dominica",@"1"],@"DM",
@[@"Dominican Republic",@"1"],@"DO",
@[@"Ecuador",@"593"],@"EC",
@[@"Egypt",@"20"],@"EG",
@[@"El Salvador",@"503"],@"SV",
@[@"Equatorial Guinea",@"240"],@"GQ",
@[@"Eritrea",@"291"],@"ER",
@[@"Estonia",@"372"],@"EE",
@[@"Ethiopia",@"251"],@"ET",
@[@"Falkland Islands (Malvinas)",@"500"],@"FK",
@[@"Faroe Islands",@"298"],@"FO",
@[@"Fiji",@"679"],@"FJ",
@[@"Finland",@"358"],@"FI",
@[@"France",@"33"],@"FR",
@[@"French Guiana",@"594"],@"GF",
@[@"French Polynesia",@"689"],@"PF",
@[@"French Southern Territories",@"689"],@"TF",
@[@"Gabon",@"241"],@"GA",
@[@"Gambia",@"220"],@"GM",
@[@"Georgia",@"995"],@"GE",
@[@"Germany",@"49"],@"DE",
@[@"Ghana",@"233"],@"GH",
@[@"Gibraltar",@"350"],@"GI",
@[@"Greece",@"30"],@"GR",
@[@"Greenland",@"299"],@"GL",
@[@"Grenada",@"1"],@"GD",
@[@"Guadeloupe",@"590"],@"GP",
@[@"Guam",@"1"],@"GU",
@[@"Guatemala",@"502"],@"GT",
@[@"Guernsey",@"44"],@"GG",
@[@"Guinea",@"224"],@"GN",
@[@"Guinea-Bissau",@"245"],@"GW",
@[@"Guyana",@"595"],@"GY",
@[@"Haiti",@"509"],@"HT",
@[@"Holy See (Vatican City State)",@"379"],@"VA",
@[@"Honduras",@"504"],@"HN",
@[@"Hong Kong, Special Administrative Region of China",@"852"],@"HK",
@[@"Hungary",@"36"],@"HU",
@[@"Iceland",@"354"],@"IS",
@[@"India",@"91"],@"IN",
@[@"Indonesia",@"62"],@"ID",
@[@"Iran, Islamic Republic of",@"98"],@"IR",
@[@"Iraq",@"964"],@"IQ",
@[@"Ireland",@"353"],@"IE",
@[@"Isle of Man",@"44"],@"IM",
@[@"Israel",@"972"],@"IL",
@[@"Italy",@"39"],@"IT",
@[@"Jamaica",@"1"],@"JM",
@[@"Japan",@"81"],@"JP",
@[@"Jersey",@"44"],@"JE",
@[@"Jordan",@"962"],@"JO",
@[@"Kazakhstan",@"77"],@"KZ",
@[@"Kenya",@"254"],@"KE",
@[@"Kiribati",@"686"],@"KI",
@[@"Korea, Democratic People's Republic of",@"850"],@"KP",
@[@"Korea, Republic of",@"82"],@"KR",
@[@"Kuwait",@"965"],@"KW",
@[@"Kyrgyzstan",@"996"],@"KG",
@[@"Lao PDR",@"856"],@"LA",
@[@"Latvia",@"371"],@"LV",
@[@"Lebanon",@"961"],@"LB",
@[@"Lesotho",@"266"],@"LS",
@[@"Liberia",@"231"],@"LR",
@[@"Libya",@"218"],@"LY",
@[@"Liechtenstein",@"423"],@"LI",
@[@"Lithuania",@"370"],@"LT",
@[@"Luxembourg",@"352"],@"LU",
@[@"Macao, Special Administrative Region of China",@"853"],@"MO",
@[@"Macedonia, Republic of",@"389"],@"MK",
@[@"Madagascar",@"261"],@"MG",
@[@"Malawi",@"265"],@"MW",
@[@"Malaysia",@"60"],@"MY",
@[@"Maldives",@"960"],@"MV",
@[@"Mali",@"223"],@"ML",
@[@"Malta",@"356"],@"MT",
@[@"Marshall Islands",@"692"],@"MH",
@[@"Martinique",@"596"],@"MQ",
@[@"Mauritania",@"222"],@"MR",
@[@"Mauritius",@"230"],@"MU",
@[@"Mayotte",@"262"],@"YT",
@[@"Mexico",@"52"],@"MX",
@[@"Micronesia, Federated States of",@"691"],@"FM",
@[@"Moldova",@"373"],@"MD",
@[@"Monaco",@"377"],@"MC",
@[@"Mongolia",@"976"],@"MN",
@[@"Montenegro",@"382"],@"ME",
@[@"Montserrat",@"1"],@"MS",
@[@"Morocco",@"212"],@"MA",
@[@"Mozambique",@"258"],@"MZ",
@[@"Myanmar",@"95"],@"MM",
@[@"Namibia",@"264"],@"NA",
@[@"Nauru",@"674"],@"NR",
@[@"Nepal",@"977"],@"NP",
@[@"Netherlands",@"31"],@"NL",
@[@"Netherlands Antilles",@"599"],@"AN",
@[@"New Caledonia",@"687"],@"NC",
@[@"New Zealand",@"64"],@"NZ",
@[@"Nicaragua",@"505"],@"NI",
@[@"Niger",@"227"],@"NE",
@[@"Nigeria",@"234"],@"NG",
@[@"Niue",@"683"],@"NU",
@[@"Norfolk Island",@"672"],@"NF",
@[@"Northern Mariana Islands",@"1"],@"MP",
@[@"Norway",@"47"],@"NO",
@[@"Oman",@"968"],@"OM",
@[@"Pakistan",@"92"],@"PK",
@[@"Palau",@"680"],@"PW",
@[@"Palestinian Territory, Occupied",@"970"],@"PS",
@[@"Panama",@"507"],@"PA",
@[@"Papua New Guinea",@"675"],@"PG",
@[@"Paraguay",@"595"],@"PY",
@[@"Peru",@"51"],@"PE",
@[@"Philippines",@"63"],@"PH",
@[@"Pitcairn",@"872"],@"PN",
@[@"Poland",@"48"],@"PL",
@[@"Portugal",@"351"],@"PT",
@[@"Puerto Rico",@"1"],@"PR",
@[@"Qatar",@"974"],@"QA",
@[@"Réunion",@"262"],@"RE",
@[@"Romania",@"40"],@"RO",
@[@"Russian Federation",@"7"],@"RU",
@[@"Rwanda",@"250"],@"RW",
@[@"Saint Helena",@"290"],@"SH",
@[@"Saint Kitts and Nevis",@"1"],@"KN",
@[@"Saint Lucia",@"1"],@"LC",
@[@"Saint Pierre and Miquelon",@"508"],@"PM",
@[@"Saint Vincent and Grenadines",@"1"],@"VC",
@[@"Saint-Barthélemy",@"590"],@"BL",
@[@"Saint-Martin (French part)",@"590"],@"MF",
@[@"Samoa",@"685"],@"WS",
@[@"San Marino",@"378"],@"SM",
@[@"Sao Tome and Principe",@"239"],@"ST",
@[@"Saudi Arabia",@"966"],@"SA",
@[@"Senegal",@"221"],@"SN",
@[@"Serbia",@"381"],@"RS",
@[@"Seychelles",@"248"],@"SC",
@[@"Sierra Leone",@"232"],@"SL",
@[@"Singapore",@"65"],@"SG",
@[@"Sint Maarten",@"1"],@"SX",
@[@"Slovakia",@"421"],@"SK",
@[@"Slovenia",@"386"],@"SI",
@[@"Solomon Islands",@"677"],@"SB",
@[@"Somalia",@"252"],@"SO",
@[@"South Africa",@"27"],@"ZA",
@[@"South Georgia and the South Sandwich Islands",@"500"],@"GS",
@[@"South Sudan",@"211"],@"SS",
@[@"Spain",@"34"],@"ES",
@[@"Sri Lanka",@"94"],@"LK",
@[@"Sudan",@"249"],@"SD",
@[@"Suriname",@"597"],@"SR",
@[@"Svalbard and Jan Mayen Islands",@"47"],@"SJ",
@[@"Swaziland",@"268"],@"SZ",
@[@"Sweden",@"46"],@"SE",
@[@"Switzerland",@"41"],@"CH",
@[@"Syrian Arab Republic (Syria)",@"963"],@"SY",
@[@"Taiwan, Republic of China",@"886"],@"TW",
@[@"Tajikistan",@"992"],@"TJ",
@[@"Tanzania, United Republic of",@"255"],@"TZ",
@[@"Thailand",@"66"],@"TH",
@[@"Timor-Leste",@"670"],@"TL",
@[@"Togo",@"228"],@"TG",
@[@"Tokelau",@"690"],@"TK",
@[@"Tonga",@"676"],@"TO",
@[@"Trinidad and Tobago",@"1"],@"TT",
@[@"Tunisia",@"216"],@"TN",
@[@"Turkey",@"90"],@"TR",
@[@"Turkmenistan",@"993"],@"TM",
@[@"Turks and Caicos Islands",@"1"],@"TC",
@[@"Tuvalu",@"688"],@"TV",
@[@"Uganda",@"256"],@"UG",
@[@"Ukraine",@"380"],@"UA",
@[@"United Arab Emirates",@"971"],@"AE",
@[@"United Kingdom",@"44"],@"GB",
@[@"United States of America",@"1"],@"US",
@[@"Uruguay",@"598"],@"UY",
@[@"Uzbekistan",@"998"],@"UZ",
@[@"Vanuatu",@"678"],@"VU",
@[@"Venezuela (Bolivarian Republic of)",@"58"],@"VE",
@[@"Viet Nam",@"84"],@"VN",
@[@"Virgin Islands, US",@"1"],@"VI",
@[@"Wallis and Futuna Islands",@"681"],@"WF",
@[@"Western Sahara",@"212"],@"EH",
@[@"Yemen",@"967"],@"YE",
@[@"Zambia",@"260"],@"ZM",
@[@"Zimbabwe",@"263"],@"ZW", nil];
使用NSLocale
:
let countries = NSLocale.ISOCountryCodes().flatMap({
(code) -> [String:String]? in
let id = NSLocale.localeIdentifierFromComponents([NSLocaleCountryCode: code])
if let name = NSLocale(localeIdentifier: NSLocale.currentLocale().localeIdentifier).displayNameForKey(NSLocaleIdentifier, value: id) {
return ["name" : name, "code" : code]
}
return nil
})