如何监控iPhone SDK中的NSSystemClockDidChangeNotification

use*_*hhh 6 iphone time notifications system

我需要知道用户是否在跳板设置中更改了系统时间.因此我的后台程序可以得到通知.根据文件,NSSystemClockDidChangeNotification是一个选择.但我不能收到任何东西:

[[NSNotificationCenter defaultCenter] addObserver:self 
                                         selector:@selector(handleSysTimeChanged:) 
                                             name:NSSystemClockDidChangeNotification 
                                           object:nil];
Run Code Online (Sandbox Code Playgroud)

我哪里错了?有什么建议?

Fel*_*lix 6

您的处理程序方法必须在您添加为观察者的同一个类中实现,并且需要如下所示:

-(void) handleSysTimeChanged: (NSNotification*) notification
{
 // ...
}
Run Code Online (Sandbox Code Playgroud)