iPhone SDK中如何检测wifi是否不可用
有什么方法可以让我们以编程方式识别用户的 wifi 何时可用/不可用?
我的应用程序需要在两个不同的设备之间交换消息。它在稳定的 wifi 设置中运行良好。但如果 wifi 不稳定,我将无法检测其他设备是否可用。
我不确定这是否符合预期,但我的基于 bonjour 的 NSNetService 发现器不会自动更新可用设备列表。这给我留下了一份不可用于交换的服务列表。
我的想法是从列表中删除所有可用的服务并开始新的搜索。
如果我正在以正确的方向思考来解决正确的问题,请告诉我。
提前致谢。
-穆拉利
Is there any way that we can programatically identify when the wifi of a user becomes available/unavailable?
My application requires exchanging messages between two different devices. It is working good in stable wifi setups. But if the wifi is unstable, I am having trouble in detecting if the other device is available or not.
I am not sure if this is expected, but my bonjour based NSNetService discoverer is not updating the available devices list automatically. This leaves me with a list of services that are not available for the exchange.
My line of thinking was to remove all the available services from the list and start a fresh search.
Please let me know if I am thinking in the right direction to solve the right problem.
Thanks in advance.
-Murali
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许 Apple 提供的 Reachability 示例代码将在这方面为您提供帮助。虽然有人说已经有一段时间没有更新了,那么这里< /a> 是一个积极维护的分支。
似乎您可以注册通知,这样您就可以获得有关网络状态的频繁信息。
Perhaps the Reachability sample code provided by Apple will help you in this regard. Although there have been people who say it hasn't been updated in a while, in which case, here is an actively maintained fork.
It seems like you can register for notifications so you can get frequent information on the state of the network.