I received the notification so I handle it like so
-(void) dateSelected:(NSNotification *) notification
{
NSLog(@"Value: %@", [[notification userInfo] valueForKey:@"date"] );
NSMutableDictionary * dateDict = [[NSDictionary alloc] initWithDictionary:[notification userInfo]];
NSLog(@"The Date Dict: %@", dateDict );
}
The logs I get are
2012-07-20 11:32: TestApp[10701:40b] Value: (null)
2012-07-20 11:32: TestApp[10428:40b] The Date Dict: {
}
If I NSLog out the notification itself it looks valid:
2012-07-20 11:33: TestApp[10457:40b] Notification: NSConcreteNotification 0x16629460 {name = date_selected_; object = {
date = 20120705;
}}
I’ve done this before and its worked.
I’m sure its simple, but today I cannot see the issue.
Any help would be appreciated.
Thanks,
-Code
It’s pretty simple, look at your log output … There’s no userInfo set in your notification. There’s just name and object. Compare your output with this one …
…
… see the difference? There’s name, object, but also userInfo in log output.
So the answer is – your notification does not contain userInfo dictionary. Look at code which fires this notification.