一个 Wi-Fi 网络中 iOS 应用程序之间的通信(无需服务器)
我需要将我的应用程序与 2 台设备进行通信。一项限制是我无法使用服务器,但所有 iOS 设备都将位于一个 Wi-Fi 网络中。我有什么选择?如何向另一台设备上运行的应用程序的另一个副本发送消息?
I need to communicate my app with 2 devices. A restriction is that I can't use a server but all iOS devices will be in one Wi-Fi network. What options do I have? How I can send a message to another copy of my app running on another device?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我不知道这是否是正确的方法,但由于你不能使用服务器,所以我能想到的方法是我们可以使用 TCP/IP 或 UDP(基于可靠性)创建套接字连接进行数据交换。
I dont know whether its a correct approach or not but as you cannot use server,so the approach i can think of is we can create a socket connection using TCP/IP or UDP(based on reliability) for data exchange.
我认为如果没有某种服务器应用程序,您就无法在运行同一应用程序的两个设备之间进行通信。
即使您可以通过 WIFI 找到其他设备,我认为您也无法判断其他设备是否正在运行该应用程序。
I dont think you can communicate between 2 devices running the same application without having some kind of server application in-between.
Even if you could find the other device over the WIFI I dont think you can tell if the other device is running the app or not.
我想你可能指的是 MultipeerConnectivity
来源: https://developer.apple.com/library/ios/文档/MultipeerConnectivity/Reference/MultipeerConnectivityFramework/
Apple 示例:
https://developer.apple.com/library/ios/samplecode /MultipeerGroupChat/Introduction/Intro.html
I think you may be referring to MultipeerConnectivity
Source: https://developer.apple.com/library/ios/documentation/MultipeerConnectivity/Reference/MultipeerConnectivityFramework/
Apple Sample:
https://developer.apple.com/library/ios/samplecode/MultipeerGroupChat/Introduction/Intro.html