简体   繁体   English

使用Multipeer Connectivity在两台设备之间同步定时器?

[英]Sync timers between two devices using Multipeer Connectivity?

I've come across a few posts that kind of address my issue, but none of them actually have the answer that I'm looking for. 我遇到了一些解决我的问题的帖子,但是他们中没有一个真的有我正在寻找的答案。 I'm using Multipeer Connectivity to connect between two devices, and I want to execute a block of code at the exact same time, with as little latency as possible. 我正在使用Multipeer Connectivity连接两个设备,我希望在完全相同的时间执行一段代码,并尽可能减少延迟。 I've gone through sending timestamps from the host to another peer to start a timer at the same time (with the Date class), but there is always at least 0.3 to 0.5 seconds of latency. 我已经通过从主机向另一个对等方发送时间戳来同时启动计时器(使用Date类),但总是存在至少0.3到0.5秒的延迟。 The problem is that the device times aren't synced perfectly. 问题是设备时间没有完全同步。 Is there any third-party framework or solution that would allow me to run code at the same time on both devices? 是否有任何第三方框架或解决方案允许我在两个设备上同时运行代码? One example of this is the app AmpMe, which syncs music across many devices. 其中一个例子是app AmpMe,它可以在许多设备上同步音乐。 I'm using Swift 3, by the way. 顺便说一句,我正在使用Swift 3。

我建议使用时间服务器来同步它们的时钟或计算它们的时钟之间的偏移量,然后使用这些偏移量在两个设备上的同一时刻启动你的定时器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用多点连接(Wifi 网络)计算两个 iOS 设备之间的距离? - How to calculate distance between two iOS devices using Multipeer connectivity(Wifi network)? 从通过Multipeer连接连接的两个设备中的任何一个进行呼叫 - Callling from either of two devices connected via Multipeer connectivity 通过Swift中的Multipeer Connectivity临时同步两个iOS设备 - Temporally synchronize two iOS devices over Multipeer Connectivity in Swift 使用Multipeer Connectivity Framework并保存附近建立的设备 - Using Multipeer Connectivity Framework and saving the nearby devices founded 多对等连接-如何查看找到的设备 - Multipeer connectivity- how to view the found devices Multipeer Connectivity框架,最多可支持45个设备 - Multipeer Connectivity framework for up to 45 devices Multipeer Connectivity - 可以连接到服务的设备数量? - Multipeer Connectivity - number of devices that can be connected to a service? iOS 7:通过Wi-Fi或对等Wi-Fi使用Multipeer Connectivity连接设备 - iOS 7 : Connecting devices using Multipeer Connectivity via wi-fi or peer to peer wi-fi 使用Multipeer连接发送数据库/领域 - sending a database/Realm using Multipeer Connectivity 如何使用Core Data和iCloud在两台设备之间同步数据? - How to Sync data between two devices using Core Data & iCloud?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM