如何在两个 IOS 设备之间使用 MultipeerConnectivity Framework 共享 .txt 文件

How to share .txt file using MultipeerConnectivity Framework between two IOS devices

来自一台 ios 设备的另一台 ios 设备的 txt 文件通过 ios 应用程序。

有没有例子,请推荐一个。

一旦两个设备都加入同一会话,您可以使用 MCSessionsendResourceAtURL... 方法实现此目的:

session.sendResourceAtURL(NSURL(fileURLWithPath: "file.txt"), withName: "file.txt", toPeer: peer, withCompletionHandler: nil)

有多个教程可用于使用 MultipeerConnectivity 框架在两个设备之间建立连接,例如 this one