应用程序是否可以检测用户设置时间/日期的时间/自动更新?
我在想,就像系统时钟的可达性一样。
答案 0 :(得分:1)
好的是UIApplicationSignificantTimeChangeNotification
通知会被更改触发。
在时间发生重大变化时发布,例如,更改 到新的一天(午夜),运营商时间更新,以及更改或来自 夏令时。此通知不包含userInfo 字典。
您只需向NSNotificationCenter
添加观察者即可获得该通知:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleTimeChangeWithNotification:) name:UIApplicationSignificantTimeChangeNotification object:nil];
答案 1 :(得分:0)
您可以在appDelegate中实施applicationSignificantTimeChange:
方法和/或订阅UIApplicationSignificantTimeChangeNotification
活动。
来自Apple文档 -
重要时间变化的示例包括午夜的到来,承运人更新时间以及夏令时的变化。委托可以实现此方法来调整显示时间或对时间变化敏感的应用程序的任何对象。