在 iOS 上将电话区号转换为城市名称 [英] Telephone area code to city name on iOS

查看:28
本文介绍了在 iOS 上将电话区号转换为城市名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Apple 的内置语音信箱应用程序中,当它在您的地址簿中找到一个它无法识别的电话号码时,它会在该号码下方显示一个大概的位置,大概是基于电话号码.他们是怎么做到的??我猜手机上有一个很大的区号和交换号码数据库,每个数据库都映射到一个城市或地区名称.有谁知道应用程序是否可以通过公共 API 访问此映射?

On Apple's built-in Voicemail app, when it finds a phone number it does not recognize in your address book, it displays an approximate location under the number, presumably based on the phone number. How did they do that?? I'd guess there's a large database of area codes and exchange numbers on the phone, each mapping to a city or region name. Does anyone know if this mapping is accessible to apps via a public API?

有很多样板代码可以将邮政编码映射到城市,但我没有看到与区号/交换区相同的代码.有什么想法吗?

There's lots of boilerplate code out there for mapping ZIP code to city, but I don't see much that does the same with area code / exchange. Any ideas?

推荐答案

有许多网站会告诉您给定区号的城市.Verizon 有一个,其他网站如 http://www.allareacodes.com/http://www.411.com/area_zip_codes 做同样的事情.您也可以在当地电话簿的前面找到相同的信息.

There are a number of web sites that will tell you the city or cities for a given area code. Verizon has one, and other sites like http://www.allareacodes.com/ and http://www.411.com/area_zip_codes do about the same thing. You can probably find the same information in the front of your local telephone directory, too.

由于可能的区号少于 1000 个,我会寻找区号列表 您可以将其包含在您的程序中.这样,无论网络连接是否可用,您应用的这一方面都将起作用.

Since there are fewer than 1000 possible area codes, I'd look for an area code list that you can include in your program. That way, this aspect of your app will work whether a network connection is available or not.

这篇关于在 iOS 上将电话区号转换为城市名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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