Find correct time on iOS device

2020-04-28 01:13发布

问题:

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.

回答1:

Use NTP protocol for getting a current time or serve a time from your server and get it on application launch.

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.



回答2:

I have a 'web service' on my site which serves you the current time in milliseconds since the Unix epoch, one request, one response, nothing else.



回答3:

I think this is the wrong place for this question. Try Apple's forums.

Because there is no way to get current time form ios device when user update time manually.

Sweet & smart .........