可以通过注册系统通知:UIApplicationSignificantTimeChangeNotification 去实现
- (void)observeUserDeviceTimeIsChanged
{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deviceTimeIsChanged) name:UIApplicationSignificantTimeChangeNotification object:nil];
}
- (void)deviceTimeIsChanged
{
NSLogI(@"用户手动调整了设备时间");
}
通过这个,我们可以获取用户改了时区、时间、24/12小时制的通知,但是信息内容有限,apple的解释是:“Posted when there is a significant change in time, for example, change to a new day (midnight), carrier time update, and change to or from daylight savings time.
This notification does not contain a userInfo
dictionary.”
即获取到的通知内容不携带userInfo 字典。