Multiple notifications -- just had to test


#1

main.m

[code] @autoreleasepool {
Logger *logger = [[Logger alloc] init];

    [[NSNotificationCenter defaultCenter] addObserver:logger
                                             selector:@selector(zoneChange:)
                                                 name:NSSystemTimeZoneDidChangeNotification
                                               object:nil];
    
    AnotherObserver *notify = [[AnotherObserver alloc] init];
    [[NSNotificationCenter defaultCenter] addObserver:notify    
                                             selector:@selector(notifyMe:)
                                                 name:NSSystemTimeZoneDidChangeNotification
                                               object:nil];

. . .
[/code]

AnotherObserver.m

[code]#import “AnotherObserver.h”
@implementation AnotherObserver

-(void)notifyMe:(NSNotificationCenter *)note
{
NSLog(@“The method “notifyMe” in the object AnotherObserver was messaged.”);
}
@end[/code]

Output on time change:
2012-01-01 11:55:05.267 Callbacks-ARC[5198:707] The system time zone has changed!
2012-01-01 11:55:05.267 Callbacks-ARC[5198:707] The method “notifyMe” in the object AnotherObserver was messaged.

Cool!