Getting country calling prefix

后端 未结 10 1248
耶瑟儿~
耶瑟儿~ 2020-12-28 21:04

Just wondering whether there are easy ways to retrieve country calling code from a user\'s phone.

For example, my app would like to pre-fill country

10条回答
  •  孤城傲影
    2020-12-28 21:56

    Well an alternate and proven way is to call WebService for this you can use http://www.webservicex.net/country.asmx's GetISD WebMethod and pass current location's country.

    This way you can be sure that you get the relevant ISD ID for the country from where user accessing the app.

    Other way is to have all the ISO countries in you SQLite database and then you perform lookup based on current location's country and show the respective entry.

    How to retrieve user's current city name? is way to find country name using CLLocationManager.

    Hope this helps,

    Thanks, Jigar

提交回复
热议问题