Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to monitor NSSystemClockDidChangeNotification in iPhone SDK

I Need to know if the user change the system time in the springboard settings.so my background program can be notified. According to doc, NSSystemClockDidChangeNotification is the one choice. but I can't receiving anything by this:

[[NSNotificationCenter defaultCenter] addObserver:self 
                                         selector:@selector(handleSysTimeChanged:) 
                                             name:NSSystemClockDidChangeNotification 
                                           object:nil];

Where am I wrong? Any suggestions?

like image 702
user hhh Avatar asked Jun 16 '11 09:06

user hhh


1 Answers

Your handler method must be implemented in the same class you add as observer and needs to look like this:

-(void) handleSysTimeChanged: (NSNotification*) notification
{
 // ...
}
like image 106
Felix Avatar answered Sep 16 '22 15:09

Felix