Access an NSNotification object

How do you access the NSDictionary that’s posted in the userInfo object of an NSNotification?

In the method you’ve picked to handle the notification, just access the object using:

    [notification userInfo]

Here’s a quick reminder of how they’re all created:
Post Notification:

[[NSNotificationCenter defaultCenter] postNotificationName:@"Feature Update" object:self userInfo:dict];


    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleFeatureUpdate:) name:@"Feature Update" object:nil];


- (void)handleFeatureUpdate:(NSNotification *)notification {
    NSLog(@"%@ updated", [notification userInfo]);

Leave a Reply

Your email address will not be published. Required fields are marked *