Two Ios devices Countdown is not running same

时间:2018-12-03 13:20:41

标签: ios swift mobile timer countdowntimer

I'm working on an app that has timmer feature after specific time app become disable. when user login from two devices with the same account timer of both device disturbs due to their mobile time difference.

I have checked true-time Pod but showing some error on the project running or building.

But One thing more if two devices time is changing then again time conflict occurs between two devices.

Please mention your best solution to get the current time even mobile time is not the same.

1 个答案:

答案 0 :(得分:0)

如果我对您的理解正确,那么您将难以获得正确的计时器值,因为用户可以登录不同的时区,因此,当您在一个时区(另一台设备的时间在另一台设备的时间)上保存小时时区不匹配,事情会发生冲突。

您可以简单地引用 UTC 时间,而不是每个时区中的时间,每个设备在整个字面上都是相同的。

您可以使用NSDate来获取它。