在iOS设备上找到正确的时间 [英] Find correct time on iOS device
问题描述
我想在iOS设备上找到正确的时间,即使用户手动设置了错误的时间。
在设置 - >常规 - >日期&如果用户取消选中该选项,则可以选择自动设置,然后如何以编程方式找到正确的时间。
I want to find out correct time on iOS devices even though user have set wrong time manually. In the setting->General->Date & Time there is option of Set Automatically if that option is uncheck by the user then how can i find the correct time programmatically.
推荐答案
使用NTP协议从服务器获取当前时间或服务时间,并在应用程序启动时获取。
Use NTP protocol for getting a current time or serve a time from your server and get it on application launch.
默认情况下,Apple不提供从NTP获取时间的任何方式,并且所有时间相关功能都使用用户可以更改的本地时间。
Apple doesn't provide by default any way to get time from NTP unfortunately and all time related function are using local time that user can change.
这篇关于在iOS设备上找到正确的时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!