获取低级 iPhone 网络信息
我有两个免费应用程序,iSys 和 iSysMonitor,它们报告有关我的 iPhone 的信息。有趣的是,他们对我的手机连接的 IP 地址意见不一。此外,虽然我可以在 iPhone 的“设置”中看到它,但两者都没有列出我的 WiFi 连接的名称。我想解决 IP 争论,并了解如何获取网络连接的名称。我查看了 CFNetwork,但它似乎专注于一旦知道网络存在就如何处理通信。
更进一步,我想挖掘一些东西,比如我正在通话的手机信号塔的 ID(当没有使用 WiFi 时)。我知道一些更高级别的 Cocoa 类可能无法访问该详细信息,而是使其可以轻松执行常见任务。
那么我该去哪里获取低级独家新闻呢?我可以获得什么信息?
I have two free apps, iSys and iSysMonitor, that report info about my iPhone. Interestingly, they disagree regarding the IP address of my cell connection. Also, neither lists the name of my WiFi connection though I can see it in the iPhone's Settings. I'd like to settle the IP argument and also learn how to get the name of my network connection. I looked at CFNetwork, but it seems to focus on how to handle communication once you know a network exists.
Going further, I'd like to dig out stuff like the ID of the cell tower that I'm talking through (when not on WiFi). I know that some of the higher level Cocoa classes probably don't give access to that detail, instead making it easy to do common tasks.
So where do I go for the low-level scoop? What info can I get my hands on?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您不想使用任何私有 API,CoreTelephony 是您唯一的选择。你总是可以要求 Apple 将一些私有 API 公开,尽管如果他们同意,它可能要到 5.x 才会出现。
CoreTelephony is the only option you have if you don't want to use any private APIs. You can always request that Apple make some of the private APIs public, although if they agree, it may not appear until 5.x.
关于 MAC 地址的堆栈溢出问题的答案 也可能适用于获取两个 IP 地址。它使用 ioctl Unix API。
如果您需要应用程序而不是代码,iStat 应用程序将返回两个 IP 地址。
The answer to this stack overflow question about MAC addresses may also work for getting both IP addresses. It uses the ioctl Unix API.
If you need an app rather than code, the iStat app will return both IP addresses.
正如其他人所说,核心电话是您最好的选择,尽管我在文档中没有看到任何可以返回手机信号塔标识的内容。如果您想坚持使用已发布的 API 并在 App Store 上分发,那么您可能在这方面运气不佳。
至于不同的 IP 地址,这对我来说很有意义:您正在谈论两个不同的设备。它们不能共享 IP 地址,就像 LAN 上的两台计算机不能共享 IP 地址一样。如果没有唯一的地址,网络上的其他设备就无法仅向该设备发送数据。
As others have said, Core Telephony is your best bet, although I don't see anything at all in the documentation that will return cell tower identification. You're probably out of luck on this one if you want to stick with published API and distribute on the App Store.
As for differing IP addresses, that makes sense to me: you're talking about two different devices. They can't share an IP address any more than two computers on a LAN can share an IP address. Without a unique address, it's not possible for something else on the network to send data to only that device.