通过SDK获取本地iPhone号码
我正在寻找 SDK API 来检索设备的本地电话号码
从 SIM 卡。 有办法做到吗?
I am looking for a SDK API to retrieve the device's local phone number
from the SIM card. Is there a way to do it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
没有什么可靠的办法。 您会在网上找到代码,告诉您查找 SBFormattedPhoneNumber,有时确实有效,但不一致。 大多数情况下,这些人是从另一家手机运营商那里带来电话号码的。 在这些情况下,您会得到一个电话号码,但不是当前电话的电话号码,也不是保证对任何事情都有效的电话号码(它甚至可能不是唯一的)。
我没有依据说这是少数人还是很多人,但这是一个未记录的密钥,本质上是不可靠的。
There's no reliable way. You'll find code online that tells you to look up SBFormattedPhoneNumber, and sometimes that works, but not consistently. Mostly it's people who brought their phone number over from another cell carrier. In those cases, you get a phone number, but not one for the current phone, and not one that's guaranteed to be valid for anything at all (it may not even be unique).
I have no basis for saying whether this is a few people or a lot, but it's an undocumented key that's inherently unreliable.
此方法指的是激活时存储在 iTunes 中的号码...所以,不要使用它。 从 4.x 开始,您可以利用 CoreTelephony 框架来获取有关网络的许多信息,但仍然没有数字...
This method refers to the number stored in iTunes at time of activation... so, don't use it. From 4.x you can take advantage from CoreTelephony framework to get many information about the network, but still no number...
请在此处查看这篇博文。
阿德里安
Take a look at this blog post here.
Adrian