如果用户关闭“自动设置”,我必须检查正确的当前时间。
有什么方法可以访问“自动设置”设置状态的状态,以便我可以提示用户将其打开。 或者 我可以遵循的另一种方法我可以从 GPS(位置)获取时间,但是下面的代码总是在用户选择的情况下给出本地时间 “自动设置”关闭。
CLLocation* location = [[CLLocation alloc] initWithLatitude:(CLLocationDegrees) 0.0 longitude:(CLLocationDegrees) 0.0];
NSDate* now = location.timestamp;
有什么方法可以在 ios 中存档此行为。
最佳答案
如果不能依赖本地时钟,则需要使用外部源。为此(可能)有几个基于 NTP 的库。比如:ios-ntp,目前可以查到here .
关于ios - 如果用户将 "Set Automatically"设置为关闭,如何检查正确的当前时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33752318/