问题描述
如果用户将自动设置"设置为关闭,我必须检查当前的正确时间.
I have to check the correct current time if user sets "Set Automatically" off.
有什么方法可以访问自动设置"设置状态,以便我提示用户将其打开.或者我可以遵循的另一种方法是我可以从GPS(位置)获取时间,但是下面的代码总是在用户选择的情况下给出本地时间关闭自动设置".
Is there any way to access the status of "Set Automatically" setting status so that I cam prompt user to turn it on.ORAnother approach I can follow I can fetch the time from GPS(location) but the below code always gives the local time in case of user selects"Set Automatically" off.
CLLocation* location = [[CLLocation alloc] initWithLatitude:(CLLocationDegrees) 0.0 longitude:(CLLocationDegrees) 0.0];
NSDate* now = location.timestamp;
有什么方法可以在ios中存档此行为.
Is there any way to archive this behavior in ios.
推荐答案
如果您不能依赖本地时钟,则需要使用外部源.为此(可能)有几个基于NTP的库.例如:ios-ntp,当前可在此处找到.
If you can't rely on the local clock, you need to use an external source. There are (probably) several NTP-based libraries for this. For example: ios-ntp, which can currently be found here.
这篇关于如果用户设置&“自动设置&",如何检查正确的当前时间.离开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!