如何判断与iPhone的连接方式是蓝牙还是WiFi?
我正在使用 bonjour 网络服务在两部 iPhone 之间创建连接。
我使用
CFStreamCreatePairWithSocketToHost(kCFAllocatorDefault,
(CFStringRef)netService.hostName, netService.port, &readStream, &writeStream);
但我不知道如何判断生成的连接是否通过蓝牙进行连接。 有没有办法确定 IP 地址...应该可以做到。
我认为遵守 Apple 的人机界面指南很重要,因为如果通过 WiFi 连接,我有时需要更新状态栏中的网络活动指示器,但如果我在蓝牙中使用该指示器,它看起来可能会产生误导联系。 (该指示灯位于 wifi 连接旁边,而不是蓝牙连接旁边)。
谢谢
I am creating a connection using a bonjour netservice between two iphones.
I connect using
CFStreamCreatePairWithSocketToHost(kCFAllocatorDefault,
(CFStringRef)netService.hostName, netService.port, &readStream, &writeStream);
But I can not figure out how I can tell if the resulting connection is over bluetooth or not.
Is there a way to determine the IP address... that should do it.
I figure that is important to comply with Apple's Human Interface Guidelines because if the connection is over WiFi I need to update the Network Activity Indicator in the status bar at times, but it looks like it might be misleading if i use that indicator in a bluetooth connection. (The indicator is beside the wifi connection, not the bluetooth one).
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我能够弄清楚。接收传入连接的服务器接收 IP 地址。蓝牙连接从 169.254.xx 开始,这应该足以满足我的需要。
I was able to figure it out. The server receiving the incoming connection receives the IP address. A bluetooth connection starts 169.254.x.x. That should be good enough for what I need.