简体   繁体   中英

libphonenumber ios get country code for country

Given a country, how do I get the countryCode? The following method is not working

NSNumber* code = [phoneUtil getCountryCodeForRegion:country];

It is working, I used it like so:

[phoneUtil getCountryCodeForRegion:@"US"]

and the output was 1.

Note that you have to use the ISO Country Code, 2 Digit: "US", (you can find a list here ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM